From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27315 invoked by alias); 9 Feb 2007 22:27:20 -0000 Received: (qmail 27307 invoked by uid 22791); 9 Feb 2007 22:27:19 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Fri, 09 Feb 2007 22:27:12 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1HFeCz-0001lT-G4; Fri, 09 Feb 2007 17:27:09 -0500 Date: Fri, 09 Feb 2007 22:27:00 -0000 From: Daniel Jacobowitz To: PoWah Wong Cc: gdb@sourceware.org Subject: Re: newbie question: debug a multiple processes server program Message-ID: <20070209222709.GA6719@nevyn.them.org> Mail-Followup-To: PoWah Wong , gdb@sourceware.org References: <802891.67096.qm@web56314.mail.re3.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <802891.67096.qm@web56314.mail.re3.yahoo.com> User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes 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/msg00062.txt.bz2 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