Access frame information in gdb

Is there a way to access content info framein gdb in a script?

I am debugging a problem somewhere between Apache, PHP, APC and my own code, and I have about a hundred cores to choose from. Following the instructions here http://bugs.php.net/bugs-generating-backtrace.php I end up with a stack:

 # 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.hoors98
 # 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 ?? ()

The stack will always look similar, but the function executeand ZEND_somethingalternates several times. I need to go to the last resort execute( up 2in this case) and print myVar.

Obviously gdb knows the names of the functions, but does it superimpose them on any user variables that I could access?

Input frame 2shows a single-line version, and info framedescribes in detail one stack. I want to do something like while ($current_frame.function_name != "execute") {up;} print myVarbut I don’t see how to do it strictly in gdb.

// /-, gdb (, bt), (, info frame)?

+3
1

GBD 7.1 Python .

0

Source: https://habr.com/ru/post/1739554/


All Articles