panda
panda copied to clipboard
pyPANDA rr_get_guest_instr_count() can overflow with large instruction counts
In panda.py the rr_get_guest_instr_count() can return negative integer numbers when the system has a large instruction count. It turns out the C API used with cffi to build pyPANDA only returns an int which appears to be causing this problem, but the actual instruction count is stored as a uint64_t.
If the header file: https://github.com/panda-re/panda/blob/dev/panda/include/panda/panda_api.h#L34
and corresponding source file: https://github.com/panda-re/panda/blob/dev/panda/src/panda_api.c#L132
are updated to return a uint64_t (how the instruction count is stored in C) and the pyPANDA python package is rebuilt, this appears to solve the problem on the Python side.
That looks like a problem. Thanks for the bug report.
Created PR #1242 to fix this issue. Verified with a very large ARM replay file that the instruction count no longer overflows when using the Python API.
PR #1242 fixes issue. Merged.