Re: how to debug applets?
- From: Martin Baulig <martin home-of-linux org>
- To: RichardHult frenzy hemmet s-hem chalmers se
- cc: gnome-list gnome org
- Subject: Re: how to debug applets?
- Date: Wed, 11 Nov 1998 19:14:07 +0100 (CET)
On Wed, 11 Nov 1998, Richard Hult wrote:
> To: gnome-list@gnome.org
> Subject: how to debug applets?
> From: Richard Hult <rhult@hem2.passagen.se>
>
> I want to try to debug the gnome-pager applet, but I can't start it
> from the command-line, so I don't know how to get gdb to chew on it...
Well, basically - if you start the applet from the command line when the
panel is already running it should work, but I did not try it out.
However, if the applet does not crash after the first few seconds (if it
does - simply insert a sleep (10) near the start of its main () function,
but not much more than about 10 seconds to avoid a timeout in the panel)
you can attach to the running process in gdb like this (don't have a
compiled version of gnome-core at the moment, so I use gtop instead):
[martin@einstein martin]$ gtop &
[1] 1931
[martin@einstein martin]$ ps x | grep gtop
1931 p1 S 0:00.00 (gtop)
1932 p1 S 0:00.00 (libgtop_server)
[martin@einstein martin]$ gdb ~/INSTALL/bin/gtop
GDB is free software and you are welcome to distribute copies of it
under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i386-unknown-freebsd),
Copyright 1996 Free Software Foundation, Inc...
(gdb) attach 1931
Attaching to program `/home/martin/INSTALL/bin/gtop', process 1931
0x203b9a11 in read ()
The program/applet will most likely stop somewhere in the C library (in a
function like read, wait, sigsuspend, ...), so you should either use the
`finish' command of gdb a few times or set a breakpoint somewhere in it
and do a `continue':
(gdb) break proc_read_load
Breakpoint 1 at 0x3842: file /home/martin/gnomecvs/gtop/proc.c, line 71.
(gdb) c
Continuing.
Breakpoint 1, proc_read_load (ps=0xb8100)
at /home/martin/gnomecvs/gtop/proc.c:71
71 glibtop_get_loadavg (&loadavg);
Then debug it as usual.
Martin
-----------------------------------------------------------------
Martin Baulig - Angewandte Mathematik - Universitaet Trier
martin@home-of-linux.org, http://www.home-of-linux.org/
------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]