nxdk-rdt
nxdk-rdt copied to clipboard
dbg.py is broken in python2
I can not get dbg.py
to work in python2 - works fine in python3 though.
System: Debian testing Python2 --version: Python 2.7.15 Python3 --version: Python 3.6.6
Output with modified dbg.py in python2:
tick_count: 12321
Allocated memory at 0x16b0000
90
[
[
Traceback (most recent call last):
File "./dbg.py", line 173, in <module>
main()
File "./dbg.py", line 134, in main
assert(val_rb[0] == val)
AssertionError
Expected output (as received in python3):
tick_count: 66258
Allocated memory at 0x18f0000
90
b'Z'
90
Testing call using RDTSC (please wait)
RDTSC measured 1.006 seconds
Used modifications in dbg.py (Click to unfold)
@@ -127,7 +127,11 @@ def main():
val = 0x5A
print("Allocated memory at 0x%x" % addr)
xbox.mem_write(addr, bytes([val]))
- assert(xbox.mem_read(addr, 1)[0] == val)
+ print(val)
+ val_rb = xbox.mem_read(addr, 1)
+ print(val_rb)
+ print(val_rb[0])
+ assert(val_rb[0] == val)
xbox.free(addr)
# Inject a function which does `rdtsc; ret`.
Since Python 2 is not maintained anymore, I think a simple change to make sure it always runs with Python 3 should be enough as a fix.