From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32088 invoked by alias); 9 Aug 2006 14:20:26 -0000 Received: (qmail 32067 invoked by uid 22791); 9 Aug 2006 14:20:23 -0000 X-Spam-Check-By: sourceware.org Received: from wr-out-0506.google.com (HELO wr-out-0506.google.com) (64.233.184.236) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 09 Aug 2006 14:20:15 +0000 Received: by wr-out-0506.google.com with SMTP id i3so17873wra for ; Wed, 09 Aug 2006 07:20:14 -0700 (PDT) Received: by 10.78.175.14 with SMTP id x14mr369135hue; Wed, 09 Aug 2006 07:20:13 -0700 (PDT) Received: by 10.78.71.20 with HTTP; Wed, 9 Aug 2006 07:20:12 -0700 (PDT) Message-ID: <113c79ae0608090720g24e47d72qd87649a9d4b34233@mail.gmail.com> Date: Wed, 09 Aug 2006 14:20:00 -0000 From: "=?UTF-8?Q?Shiladitya_?= =?UTF-8?Q?(=E0=A6=B6=E0=A6=BF=E0=A6=B2=E0=A6=BE?= =?UTF-8?Q?=E0=A6=A6=E0=A6=BF=E0=A6=A4=E0=A7=8D=E0=A6=AF)?=" To: Shriek , gdb@sourceware.org Subject: Re: Need help in debugging daemons with GDB In-Reply-To: <113c79ae0608082338l1975b171p70ecb223cb468c1@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3ce33f6c0608082326g5da2ee6co5530fb0de8af94e9@mail.gmail.com> <113c79ae0608082338l1975b171p70ecb223cb468c1@mail.gmail.com> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-08/txt/msg00068.txt.bz2 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 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 >