This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Need help in debugging daemons with GDB


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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]