From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21508 invoked by alias); 9 Feb 2007 22:18:01 -0000 Received: (qmail 21487 invoked by uid 22791); 9 Feb 2007 22:18:00 -0000 X-Spam-Check-By: sourceware.org Received: from web56314.mail.re3.yahoo.com (HELO web56314.mail.re3.yahoo.com) (216.252.110.238) by sourceware.org (qpsmtpd/0.31) with SMTP; Fri, 09 Feb 2007 22:17:54 +0000 Received: (qmail 2204 invoked by uid 60001); 9 Feb 2007 22:17:52 -0000 X-YMail-OSG: 6MqxLM4VM1n__M63cJvhJ4OQOFIRK8Lr5tEZDcJGbD8JRcjvjseA1jXacv1oyClzbPecawwdxNDgUoNYOH09WzNro.p6Q0tcIMA0EInsl2mhd7rf4mnQvsF66vmW89FUs4vR2YnfjCYUnco- Received: from [142.46.196.26] by web56314.mail.re3.yahoo.com via HTTP; Fri, 09 Feb 2007 14:17:52 PST X-Mailer: YahooMailRC/368.7 YahooMailWebService/0.6.132.7 Date: Fri, 09 Feb 2007 22:18:00 -0000 From: PoWah Wong Subject: newbie question: debug a multiple processes server program To: gdb@sourceware.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <802891.67096.qm@web56314.mail.re3.yahoo.com> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-02/txt/msg00061.txt.bz2 I want to debug a server program testd which calls fork() to create multipl= e 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=20 http://mail.yahoo.com