gdb python模块读取内存内容 [英] gdb python module read memory content

查看:270
本文介绍了gdb python模块读取内存内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在gdb内以特定内存地址打印内容,我可以运行以下命令。它将内容打印为十六进制

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正在使用gdb内的gdb python模块,等效命令是在我的python脚本内读取gdb模块的内存位置。

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.

推荐答案

我猜是您想要的

(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'

这篇关于gdb python模块读取内存内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆