This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: newbie question: debug a multiple processes server program
- From: Daniel Jacobowitz <drow at false dot org>
- To: PoWah Wong <wong_powah at yahoo dot ca>
- Cc: gdb at sourceware dot org
- Date: Fri, 9 Feb 2007 17:27:09 -0500
- Subject: Re: newbie question: debug a multiple processes server program
- References: <802891.67096.qm@web56314.mail.re3.yahoo.com>
On Fri, Feb 09, 2007 at 02:17:52PM -0800, PoWah Wong wrote:
> This is what I am think, please comment:
> - cd src
> - Start testd by ../linux/testd
> - Start gdb
> - Load debugging info
> symbol-file ../linux/testd
Always use "file".
> - Attach to the parent process (i.e. pid 31629)
> - set breakpoint in the foo() of the util.c
> b foo
> - Resume testd execution
> run
"continue"
> - Execute the client program
> - Wait for breakpoint to occur
Yes, this is usually the best way. If you know which process the bug
will occur in, you can also get to it by running the program under
GDB and using "catch fork" and "set follow-fork-mode".
--
Daniel Jacobowitz
CodeSourcery