I have a set of basic breakpoints defined in a user-defined fn setup
in my .gdbinit. So, every time i start gdb, I have to execute that fn. to set all my brkpoints , before I start debugging. Can I configure my .gdbinit so that whenever it starts , it first executes my user-defined fn setup
?
views:
567answers:
1
A:
Just call it by function name:
My .gdbinit:
define setup
echo Foobar\n
end
setup #This is the function call
And when I run it:
$ 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)
Kimvais
2009-12-16 08:31:09
Not working for me - gives this error:.No symbol table is loaded. Use the "file" command.No symbol table is loaded. Use the "file" command.No symbol table is loaded. Use the "file" command.No symbol table is loaded. Use the "file" command./home/sbhowmick/.gdbinit:83: Error in sourced command file:No executable file specified.Use the "file" or "exec-file" command.Using host libthread_db library "/lib/tls/libthread_db.so.1".I'm using GNU gdb Red Hat Linux (6.3.0.0-1.138.el3rh)
shan23
2009-12-16 10:28:25
My .gdbinit file looks like this:define setup br fn1 br fn2enddefine some_other_fn ...endsetup
shan23
2009-12-16 10:29:27
This is because you don't have the binary file loaded, if you are defining breakpoints, the binary must be loaded already when starting GDB, e.g. you must define "file a.out" or smtg like that in your .gdbinit before setting the breakpoints or run "gdb a.out" or so.
Kimvais
2009-12-16 17:38:01