This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Need help in debugging daemons with GDB
- From: "Shiladitya (àààà ààààà)" <shiladitya dot biswas at gmail dot com>
- To: Shriek <shriek dot 007 at gmail dot com>, gdb at sourceware dot org
- Date: Wed, 9 Aug 2006 19:50:12 +0530
- Subject: Re: Need help in debugging daemons with GDB
- References: <3ce33f6c0608082326g5da2ee6co5530fb0de8af94e9@mail.gmail.com> <113c79ae0608082338l1975b171p70ecb223cb468c1@mail.gmail.com>
There is a simple way to get around that. Create a shell script by the same
name as the daemon that you intend to debug and replace the daemon by
the script. Let us say you daemon is called "shriek". Rename it to
"shriek_real" and name your shell script as "shriek". shriek will
look like this :
"
#! /bin/sh
/usr/bin/xterm -e gdb -x {full_path}/gdb_script
"
and your gdb_script will look like this:
"
file {full_path}/shriek_real
b addr
r
"
You will be able to get control of the daemon right at its entry point
when you restart the daemon "script".
Hope that helps
On 8/9/06, Shriek <shriek.007@gmail.com> wrote:
> I am not sure this is the correct mailing list for this but did not
> find another suitable one ...
> I am debugging a daemon in FreeBSD and I am particularly interested in
> the initialization functions activity as the daemon starts ...
> conventionally I attach the GDB to the PID and supply the unstripped
> object file of the daemon as argument. Now the problem with this is
> when you stop the daemon and restart there is no info of the PID
> avaliable for attaching the GDB, thus I cannot get to see the
> initialization functions ... and by the time you get to know PID the
> initialization stuff is already history :-)
>
--
--
Shiladitya