Scripting 在gdb中访问帧信息
在gdb中,有没有一种方法可以访问脚本中Scripting 在gdb中访问帧信息,scripting,gdb,Scripting,Gdb,在gdb中,有没有一种方法可以访问脚本中info frame的内容 我正在调试Apache、PHP、APC和我自己的代码之间的某个问题,我有大约一百个内核可供选择。按照这里的说明操作 我最终得到了一个stacktrace,如: #0 0x0121a31a in do_bind_function (opline=0xa94dd750, function_table=0x9b9cf98, compile_time=0 '\0') at /usr/src/debug/php-5.2.7/Zend/z
info frame
的内容
我正在调试Apache、PHP、APC和我自己的代码之间的某个问题,我有大约一百个内核可供选择。按照这里的说明操作
我最终得到了一个stacktrace,如:
#0 0x0121a31a in do_bind_function (opline=0xa94dd750, function_table=0x9b9cf98, compile_time=0 '\0') at /usr/src/debug/php-5.2.7/Zend/zend_compile.c:2407
#1 0x0124bb2e in ZEND_DECLARE_FUNCTION_SPEC_HANDLER (execute_data=0xbfef7990) at /usr/src/debug/php-5.2.7/Zend/zend_vm_execute.h:498
#2 0x01249dfa in execute (op_array=0xb79d5d3c) at /usr/src/debug/php-5.2.7/Zend/zend_vm_execute.h:92
#3 0x01261e31 in ZEND_INCLUDE_OR_EVAL_SPEC_VAR_HANDLER (execute_data=0xbfef80d0) at /usr/src/debug/php-5.2.7/Zend/zend_vm_execute.h:7809
#4 0x01249dfa in execute (op_array=0xb79d55ec) at /usr/src/debug/php-5.2.7/Zend/zend_vm_execute.h:92
...
#26 0x09caa894 in ?? ()
#27 0x00000000 in ?? ()
#0 0x0121a31a位于/usr/src/debug/php-5.2.7/Zend/Zend_compile.c:2407的do_bind_函数(opline=0xa94dd750,function_table=0x9b9cf98,compile_time=0'\0')中
#1 0x0124BB2位于/usr/src/debug/php-5.2.7/ZEND/ZEND_vm_execute.h:498的ZEND_DECLARE_函数_SPEC_处理程序(execute_data=0xbfef7990)中
#2 0x01249dfa在/usr/src/debug/php-5.2.7/Zend/Zend_vm_execute.h:92处执行(op_数组=0xb79d5d3c)
#3 0x01261e31位于/usr/src/debug/php-5.2.7/ZEND/ZEND\u vm\u execute.h:7809的ZEND\u INCLUDE\u或\u EVAL\u SPEC\u VAR\u处理程序(execute\u data=0xbfef80d0)中
#4 0x01249dfa在/usr/src/debug/php-5.2.7/Zend/Zend_vm_execute.h:92处执行(op_数组=0xb79d55ec)
...
#26 0x09caa894英寸??()
#27 0x00000000英寸??()
堆栈看起来总是相似的,函数execute
和ZEND_something
交错多次。我需要转到execute
的最后一个实例(本例中为up 2
)和print myVar
显然gdb知道函数名,但它是否在我可以访问的任何用户变量中显示它们
键入frame 2
显示单行版本,info frame
详细显示单个堆栈帧。我想做一些像
while($current_frame.function_name!=“execute”){up;}print myVar
但我不知道如何严格地在gdb中执行它
是否有变量/结构/特殊内存位置/允许访问整个堆栈(如
bt
)或当前堆栈帧(如info-frame
)上gdb信息的东西?GBD 7.1支持从Python编写这种脚本。看起来这是唯一一种不使用expect之类的疯狂工具和编写大量奇怪脚本的方法。