Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get the number of instructions in a replay file in Python Panda? #1299

Open
tylzh97 opened this issue Apr 4, 2023 · 1 comment
Open

Comments

@tylzh97
Copy link
Contributor

tylzh97 commented Apr 4, 2023

I found in Python Pandas that the function panda.rr_get_guest_instr_count() can get the number of instructions currently executed, and I also found in rr_log.h that the total number of instructions in the current replay file can be obtained through rr_nondet_log->last_prog_point.guest_instr_count. So how can I get this value in Python?

@lacraig2
Copy link
Member

That's not currently something that's exposed to python.

There's a few ways to get at that value. The easiest of which would likely be adding a PANDA API function in the same way that panda.rr_guest_get_instr_count has:

You would need to add a function near here:

panda/panda/src/panda_api.c

Lines 132 to 134 in 35339e8

uint64_t rr_get_guest_instr_count_external(void){
return rr_get_guest_instr_count();
}

add the definition to the header file and also add a method in panda.py:

'''
return self.libpanda.rr_get_guest_instr_count_external()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants