Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: PoWah Wong <wong_powah@yahoo.ca>
To: gdb@sourceware.org
Subject: newbie question: debug a multiple processes server program
Date: Fri, 09 Feb 2007 22:18:00 -0000	[thread overview]
Message-ID: <802891.67096.qm@web56314.mail.re3.yahoo.com> (raw)

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


             reply	other threads:[~2007-02-09 22:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-09 22:18 PoWah Wong [this message]
2007-02-09 22:27 ` Daniel Jacobowitz
2007-02-09 22:38 ` Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=802891.67096.qm@web56314.mail.re3.yahoo.com \
    --to=wong_powah@yahoo.ca \
    --cc=gdb@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox