输入info variables列出"All global and static variable names" .
键入info locals以列出"Local variables of current stack frame"(名称和值),包括该函数中的静态变量 .
键入info args以列出"Arguments of the current stack frame"(名称和值) .
408
如果你想看到调用函数的局部变量,请在 info locals 之前使用 select-frame
例如 . :
(gdb) bt
#0 0xfec3c0b5 in _lwp_kill () from /lib/libc.so.1
#1 0xfec36f39 in thr_kill () from /lib/libc.so.1
#2 0xfebe3603 in raise () from /lib/libc.so.1
#3 0xfebc2961 in abort () from /lib/libc.so.1
#4 0xfebc2bef in _assert_c99 () from /lib/libc.so.1
#5 0x08053260 in main (argc=1, argv=0x8047958) at ber.c:480
(gdb) info locals
No symbol table info available.
(gdb) select-frame 5
(gdb) info locals
i = 28
(gdb)
3 回答
输入info variables列出"All global and static variable names" .
键入info locals以列出"Local variables of current stack frame"(名称和值),包括该函数中的静态变量 .
键入info args以列出"Arguments of the current stack frame"(名称和值) .
如果你想看到调用函数的局部变量,请在
info locals
之前使用select-frame
例如 . :
此外,由于
info locals
不显示您所在函数的参数,因此请使用例如:
argc
和argv
将不会被info locals
显示 . 该消息将是"No locals."参考:info locals command .