This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

using continue from .gdbinit


I am trying to debug a unix daemon which is spawned by a master process.
The master process is configured to cause children it forks off to sleep for 15 seconds which is long enough to start gdb on them.


I have a script which tails the log output by the master looking for a line which indicates it has spawned off a child. Once this line is found the script launches an xterm like this.

xterm -T {} -e gdb /usr/lib/cyrus-imapd/imapd {}

where {} is replaced by the pid.

My .gdbinit file has the following:
set breakpoint pending on
directory /home/xxx/src
b imapd.c:5171
b imapd.c:5242
continue

When gdb is invoked I would like the continue command at the bottom of the init file to cause execution to resume but it appears the continue is executed by gdb before the daemon is loaded.

In the xterm I have to manually type "c" to cause gdb to continue. This works since by the time I manually type "c" the program has already been loaded. I want the session to be interactive and to stop at the breakpoints I have set. Is there a way to automatically cause gdb to continue after the daemon has been loaded?

GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-37.el5_7.1)
Copyright (C) 2009 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".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Really redefine built-in command "frame"? (y or n) [answered Y; input not from terminal]
Really redefine built-in command "thread"? (y or n) [answered Y; input not from terminal]
No symbol table is loaded. Use the "file" command.
Breakpoint 1 (imapd.c:5171) pending.
No symbol table is loaded. Use the "file" command.
Breakpoint 2 (imapd.c:5242) pending.
/root/.gdbinit:297: Error in sourced command file:
No executable file specified.
Use the "file" or "exec-file" command.
Reading symbols from /usr/lib/cyrus-imapd/imapd...done.
Attaching to program: /usr/lib/cyrus-imapd/imapd, process 25831
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]