我正在按照以下步骤定位当前的 PHP 函数调用,如下所示:
运行虚拟脚本:
$ gdb -ex run --args php -r "sleep(10);"
按下Ctrl+C返回
gdb
运行:(gdb) bt full #1 0x00007ffff6007dd4 in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:137 ts = {tv_sec = 8, tv_nsec = 306649388} set = {__val = {65536, 0 <repeats 15 times>}} oset = {__val = {0, 4469319, 4294967295, 8081486, 140737319884960, 140737354070488, 15761488, 15454080, 15337134, 140737354001040, 0, 7307048, 16048064, 206158430232, 140737488342304, 140737488342096}} result = <optimized out> #2 0x00000000006156ef in zif_sleep () No symbol table info available. #3 0x00000000006ddd7b in dtrace_execute_internal () No symbol table info available. #4 0x000000000079dde5 in ?? () No symbol table info available. #5 0x0000000000717b18 in execute_ex () No symbol table info available. #6 0x00000000006ddc79 in dtrace_execute_ex () No symbol table info available. #7 0x00000000006e1b0a in zend_eval_stringl () No symbol table info available. #8 0x00000000006e1bf9 in zend_eval_stringl_ex () ... (gdb) frame 2 #2 0x00000000006156ef in zif_sleep () (gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name Attempt to extract a component of a value that is not a structure. (gdb) print (char *)(executor_globals.function_state_ptr->function) Attempt to extract a component of a value that is not a structure. (gdb) print (char *)(executor_globals) $2 = 0xffffffffffffcf48 <error: Cannot access memory at address 0xffffffffffffcf48>
所以似乎
executor_globals
符号不可用。是因为二进制文件已经优化了,我在错误的框架中还是别的什么?或者我应该lldb
改用?