2008-09-19 80 views
78

我試圖使用--command標誌自動化gdb會話。我試圖在一個共享庫的函數中設置一個斷點(一個DLL的Unix等價物)。我cmds.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」來設置將來未來共享庫加載的斷點?

我記得我能夠做些事情,但不記得是什麼。

+0

相關:可以gdb的消息「從終端輸入不是」被抑制?](HTTP:// stackoverflow.com/questions/23005668/can-gdbs-input-not-from-terminal-messages-be-suppressed) – TooTone 2015-07-16 11:08:02

回答

123

在回答自己解釋說,我想給的答案,有人給了我在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 

所以設置斷點上未決的伎倆;它被用於cmds.gdb,例如,

set breakpoint pending on 
break <source file name>:<line number> 
+6

耶!今天我學到了一些關於GDB的新東西=) – Branan 2008-09-19 15:46:59

+0

已經保存了我的培根,嘗試在Windows 7下使用MinGW進行調試,默認設置與Linux不同 - 很多謝謝 – bph 2012-05-16 09:22:20

0

例如,您需要在main中斷,然後運行到該中斷。所以共享庫將被加載。

apache

5

沒有符號。

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 <acl_delete_entry>:  stwu r1,-32(r1) 
0x2bd4 <acl_delete_entry+4>: mflr r0 
0x2bd8 <acl_delete_entry+8>: stw  r29,20(r1) 
0x2bdc <acl_delete_entry+12>: stw  r30,24(r1) 
0x2be0 <acl_delete_entry+16>: mr  r29,r4 
0x2be4 <acl_delete_entry+20>: li  r4,28972 
8

OT:在終端它看起來像這樣調試卡哈在一條線:

gdb -ex "set breakpoint pending on" -ex "break gdk_x_error" -ex run --args caja --sync 
相關問題