如果它不是内存,我如何直接在gdb中输出变量的类型?

时间:2017-02-14 01:06:06

标签: python gdb

在尝试使用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.

是否有针对此问题的解决方法,以便可以直接获取变量的类型?

1 个答案:

答案 0 :(得分:1)

似乎可以使用Python API直接解决此问题。

(gdb) python print gdb.parse_and_eval("appendLock->owner").type
Arachne::ThreadContext *