Stack overflow地址:c++ - How to set breakpoints on future shared libraries with a command flag - Stack Overflow
翻译:
我正在尝试使用 --command标识自动化一个gdb会话。我尝试设置一个断点在一个共享库的函数中(相当于windows的dll)。我的gdb命令像下面这样:
set args /home/shlomi/conf/bugs/kde/font-break.txt
b IA__FcFontMatch
r
然而,我得到了下面几点:
shlomi:~/progs/bugs-external/kde/font-breaking$ gdb --command=cmds.gdb...
GNU gdb 6.8-2mdv2009.0 (Mandriva Linux release 2009.0)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-mandriva-linux-gnu"...
(no debugging symbols found)
Function "IA__FcFontMatch" not defined.
Make breakpoint pending on future shared library load? (y or [n]) [answered N; input not from terminal]
所以它最终没有设置断点。我改怎么做让它默认回答y来设置断点,等待在未来的共享库加载上。
我记得我可以做些什么,但是什么也想不起来。
Answers1:
回复我自己,我想要给出一个答案,这是一个人在 IRC上给我的答案:
(gdb) apropos pending
actions -- Specify the actions to be taken at a tracepoint
set breakpoint -- Breakpoint specific settings
set breakpoint pending -- Set debugger's behavior regarding pending breakpoints
show breakpoint -- Breakpoint specific settings
show breakpoint pending -- Show debugger's behavior regarding pending breakpoints
因此,set breakpoint pending on是骗人的;它在 cmds.gdb中像下面这样:
set breakpoint pending on
break :
Answers2:
OT:在终端中,它看起来像下面这样一行来调试Caja:
gdb -ex "set breakpoint pending on" -ex "break gdk_x_error" -ex run --args caja --sync
Answers3:
没有任何符号。
objdump -t /lib/libacl.so
SYMBOL TABLE:
no symbols
objdump -T /lib/libacl.so
...
00002bd0 g DF .text 000000d0 ACL_1.0 acl_delete_entry
...
(gdb) break 0x0002bd0
(gdb) x/20i acl_delete_entry
0x2bd0 : stwu r1,-32(r1)
0x2bd4 : mflr r0
0x2bd8 : stw r29,20(r1)
0x2bdc : stw r30,24(r1)
0x2be0 : mr r29,r4
0x2be4 : li r4,28972