gdb python module read memory content

雨燕双飞 提交于 2020-01-24 19:14:51

问题


Inside gdb to print the content at a particular memory address, I can ran the below command. It prints the content in hex

x <memoryaddress>

(gdb) x 299395816
0x11d86ae8: 0x0ec14153

I am using the gdb python module inside the gdb, what's the equivalent command to read the memory location with the gdb module inside my python script.


回答1:


I guess this is what you want

(gdb) python i = gdb.inferiors()[0]
(gdb) python m = i.read_memory(0x7fffffffe39c, 4) # an int32
(gdb) python print(m.tobytes())
b'\x01\x00\x00\x00'


来源:https://stackoverflow.com/questions/46572440/gdb-python-module-read-memory-content

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!