在尝试使用 Python 开发 gdb
插件时,我在尝试直接获取变量的类型时遇到了以下错误。
(gdb) p appendLock->owner
$2 = (Arachne::ThreadContext *) 0x7ff620001a40
(gdb) whatis appendLock->owner
Attempt to take address of value not located in memory.
(gdb) ptype appendLock->owner
Attempt to take address of value not located in memory.
有没有办法解决这个问题,以便可以直接获取变量的类型?
最佳答案
看来有一种直接的方法可以使用 Python API 来执行此操作,从而绕过此问题。
(gdb) python print gdb.parse_and_eval("appendLock->owner").type
Arachne::ThreadContext *
关于python - 如果不是内存,如何直接输出gdb中变量的类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42216203/