2009-12-16 68 views

回答

9

只是把它的函數名稱:

我.gdbinit:

define setup  
    echo Foobar\n 
end 

setup #This is the function call 

當我運行它:

$ gdb 
GNU gdb Fedora (6.8-37.el5) 
Copyright (C) 2008 Free Software Foundation, Inc. 
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> 
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 "x86_64-redhat-linux-gnu". 
Foobar 
(gdb) 
+0

我不工作 - 給這個錯誤: 。無符號表被加載。使用「文件」命令。 沒有符號表被加載。使用「文件」命令。 沒有符號表被加載。使用「文件」命令。 沒有符號表被加載。使用「文件」命令。 /home/sbhowmick/.gdbinit:83:源文件中的錯誤: 未指定可執行文件。 使用「文件」或「exec-file」命令。 使用主機libthread_db庫「/lib/tls/libthread_db.so.1」。 我使用GNU GDB的Red Hat Linux(6.3.0.0-1.138.el3rh) – TCSGrad 2009-12-16 10:28:25

+0

我.gdbinit中看起來是這樣的: 定義設置 BR FN1 BR FN2 結束 定義some_other_fn ... 結束 設置 – TCSGrad 2009-12-16 10:29:27

+0

這是因爲你沒有加載二進制文件,如果你正在定義斷點,二進制必須在啓動GDB時加載,例如您必須在設置斷點或運行「gdb a.out」之前在.gdbinit中定義「file a.out」或smtg。 – Kimvais 2009-12-16 17:38:01

相關問題