This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: Just-In-Time debugging with GDB
- To: Michael Elizabeth Chastain <chastain at cygnus dot com>
- Subject: Re: Just-In-Time debugging with GDB
- From: Mike Kistler <kistler at cs dot utexas dot edu>
- Date: Mon, 21 Aug 2000 00:25:19 -0500
- CC: gdb at sources dot redhat dot com
- References: <200008210139.SAA05106@train2.cygnus.com>
Michael,
Thanks for the excellent suggestion. I used getppid to get the
process id, then opened and read /proc/$ppid/cmdline. When
running under gdb, the cmdline contains "gdb". Now I've just
got some fine tuning to do when launching gdb from within my
code and I'll be all set.
Mike Kistler
Michael Elizabeth Chastain wrote:
> Hi Mike,
>
> > Is there some technique I can use to determine if my program is
> > running under the control of gdb?
>
> In general, tracing a child doesn't disturb the child in a detectable
> way.
>
> You could call getppid() and then have a look at that process one way
> or another (shell out to 'ps --pid $getppid()').
>
> Michael Elizabeth Chastain
> <mailto:chastain@redhat.com>
> "love without fear"