Automatic backtrace [Was: Re: NetAPP/Samba 3.0/plugs]
Andrew Bartlett
abartlet at pcug.org.au
Wed Mar 13 21:00:03 GMT 2002
Scott Gifford wrote:
>
> Tim Potter <tpot at samba.org> writes:
>
> > On Thu, Mar 14, 2002 at 08:47:39AM +1100, Andrew Bartlett wrote:
> >
> > > > "Esh, Andrew" wrote:
> > > >
> > > > Can the smbd process pid be passed to a panic action?
> > >
> > > Yes, %d. I have a panic action that opens an xterm with gdb already in
> > > it.
> > >
> > > What I think would be nice is if we could make the stdout/stderr of
> > > 'panic action' end up in the current logfile. That should not be that
> > > hard actually...
>
> Probably this should be optional, to make sure that your gdb xterm
> trick still works. Maybe output could be sent to the logfile if the
> last character of the panic action command was "|", as in Perl:
>
> panic action = /path/to/backtrace_script|
I see no reason why you would need this - currently stdout and stderr
are just /dev/null, so it should not make any difference pointing it at
a file. Remmeber xterm doesn't output anything on stdout, only on the X
socket. (unless is errors, in which case we may well want to see
that...)
> > > Then, by using echo "bt full" | gdb /proc/%d/exe %d we have the
> > > backtrace in the logfile. The tricky bit is getting the path to the exe
> > > and the gdb stuff portably, not the actual script.
>
> [...]
>
> > If you're not running on Linux then you might be able to use argv[0]
> > as the path to the executable or some other combination of tricks.
>
> Especially if, when Samba starts up, it saves the current working
> directory and the $PATH.
>
> Other OS's come with other debuggers, too, such as dbx and adb. It
> may be worth considering supporting those. Maybe a backtrace shell
> script could search for one of several supported debuggers, and then
> know how to get a backtrace from it.
Or make gdb find the relevent debugger a build time. Either would work.
I think this just might happen... :-)
Andrew Bartlett
--
Andrew Bartlett abartlet at pcug.org.au
Manager, Authentication Subsystems, Samba Team abartlet at samba.org
Student Network Administrator, Hawker College abartlet at hawkerc.net
http://samba.org http://build.samba.org http://hawkerc.net
More information about the samba-technical
mailing list