Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Jan 2001 15:37:14 -0800
From:      "Brian O'Shea" <boshea@ricochet.net>
To:        Thierry <tjmsdn@ifrance.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: gdb question
Message-ID:  <20010103153714.B637@beastie.localdomain>
In-Reply-To: <01010312453500.00430@FreeBSD.eicon.com>; from tjmsdn@ifrance.com on Wed, Jan 03, 2001 at 12:37:21PM -0500
References:  <01010312453500.00430@FreeBSD.eicon.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jan 03, 2001 at 12:37:21PM -0500, Thierry wrote:
> 
> Hi,
> 
> I use the "fork" function to call another function "foo( )" 
> 
> In gdb, I would like to put a breakpoint in this function "foo( )", When I
> execute, the function "foo( )" is stopped, but gdb doesn't give me the hand.
> 
> How I can put a breakpoint in a function call by a "fork" system ?

Since foo() is called in another process (the child process of the
one that called fork()), you will have to somehow attach to the child
process after the fork() call.  I don't know if gdb has support for
doing this automatically.  I don't think it does, but you might be
able to attach to it in another gdb session by having the child
process sleep for a while shortly after the fork() call to give you
enough time to look up the PID of the child process.

> 
> Thanks in Advance.
> Thierry.
>  

-- 
Brian O'Shea
boshea@ricochet.net


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010103153714.B637>