* newbie question: debug a multiple processes server program
@ 2007-02-09 22:18 PoWah Wong
2007-02-09 22:27 ` Daniel Jacobowitz
2007-02-09 22:38 ` Nick Roberts
0 siblings, 2 replies; 3+ messages in thread
From: PoWah Wong @ 2007-02-09 22:18 UTC (permalink / raw)
To: gdb
I want to debug a server program testd which calls fork() to create multiple processes.
testd is created as follow:
g++ -g -o linux/util.o src/util.c
...
ar -r linux/libUtilLib2.a linux/util.o ...
g++ -lpthread -ldl -g -o linux/testd linux/libUtilLib2.a ...
testd is started as follows:
# linux/testd
# ps -ef|grep test
root 31629 1 1 16:51 ? 00:00:00 linux/testd
root 31630 31629 0 16:51 ? 00:00:00 linux/testd
root 31631 31630 0 16:51 ? 00:00:00 linux/testd
root 31632 31630 0 16:51 ? 00:00:00 linux/testd
root 31633 31630 0 16:51 ? 00:00:00 linux/testd
root 31634 31630 0 16:51 ? 00:00:00 linux/testd
root 31635 31630 0 16:51 ? 00:00:00 linux/testd
root 31636 31630 0 16:51 ? 00:00:00 linux/testd
root 31637 31630 0 16:51 ? 00:00:00 linux/testd
root 31638 31630 0 16:51 ? 00:00:00 linux/testd
root 31639 31630 0 16:51 ? 00:00:00 linux/testd
root 31640 31630 0 16:51 ? 00:00:00 linux/testd
The program testd has a bug in the foo() of the util.c in the src directory.
What is the best way to setup gdb to debug this program?
This is what I am think, please comment:
- cd src
- Start testd by ../linux/testd
- Start gdb
- Load debugging info
symbol-file ../linux/testd
- Attach to the parent process (i.e. pid 31629)
- set breakpoint in the foo() of the util.c
b foo
- Resume testd execution
run
- Execute the client program
- Wait for breakpoint to occur
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-02-09 22:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 22:18 newbie question: debug a multiple processes server program PoWah Wong
2007-02-09 22:27 ` Daniel Jacobowitz
2007-02-09 22:38 ` Nick Roberts
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox