![]() |
|
last modified: Contents:
Introduction: This document is to help those Mac and Windows people debug Mozilla
on Linux. This is a work in progress.
Question: How do I debug 5.0 on Linux? $ cd mozilla/dist/bin
If you are new to debugging on Linux, I recommend using ddd.
ddd is a graphical debugger that runs on top of gdb. You may still
find yourself doing gdb command from within ddd.
Question: How do I use ddd / gdb? Start here: http://www.gnu.org/manual/gdb-4.17/html_mono/gdb.html
Question: the debugger (gdb/ddd) is slow. How can I make it faster? add this line to your $HOME/.gdbinit file:
This will cause gdb to lazily read symbol tables. (If you are using this option with glibc 2.1, please see What should I do about the SIG32 I'm getting in RH 6.0?) Example: I'm debugging apprunner. I interrupt the process. Looking at the stack trace, I see this: (gdb) where #0 0x4085e7d0 in ?? () from /lib/libc.so.6
To load the symbol tables, I'd do this on the gdb console: (gdb) shar libwidgetgtk.so
Now, if I do "where" again to see the stack trace, I get this: (gdb) where #0 0x4085e7d0 in __poll (fds=0x83171f8, nfds=3, timeout=19) at
../sysdeps/unix/sysv/linux/poll.c:45
Advanced tricks:
"shar msg" will load any libraries (used by the process you are debugging) that match this pattern lib*msg* (gdb) shar msg
2) ramiro mozilla/tools/debug/gdb/solib.gdbinit I added some macros to load symbols from chunks of code that im
thanks to Arun Sharma for this tip.
Question: I can't set a break point in 'nsNntpService::~nsNntpService(void)'. Why won't gdb let me?
Question: What is strace and how do I use it? strace is your friend. more on this later.
Question: Where do I break to track down aborts? PR_ASSERT() vs NS_ASSERTION() on Linux. (gdb) b abort
Question: Why do I keep stopping with SIG32? How do I stop that? for rh 6.0, you may need to add this line to your $HOME/.gdbinit file:
With the landing of Necko, mozilla is a multi-threaded application on Unix. Unfortunately, this confuses pthreads when run under gdb on glibc 2.1 with the auto-solib-add option. The solution is to have libpthread.so loaded when the first thread gets created. One trick to do this is to set a breakpoint in main() and then load libpthread at this point: gdb ./apprunner GNU gdb 4.17.0.11 with Linux support Copyright 1998 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or 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. This GDB was configured as "i386-redhat-linux"... (gdb) tbreak main Breakpoint 1 at 0x804b289: file nsAppRunner.cpp, line 808. (gdb) run Starting program: .../mozilla/dist/bin/./apprunner Breakpoint 1, main (argc=1, argv=0xbffff8a4) at nsAppRunner.cpp:808 808 rv = NS_InitXPCOM(NULL); (gdb) sha pthread Reading symbols from /lib/libpthread.so.0...done. (gdb) contYou can also add these lines to your .gdbinit: def prun tbreak main run sha pthread cont endAnd then simply type "prun" instead of "run" to run apprunner. Question: How do I use the LD_BIND_NOW environment variable? You might want to add information about environment. I always
have this
export LD_BIND_NOW=1 or, if you are using tcsh as your shell: setenv LD_BIND_NOW 1 The LD_BIND_NOW=1 keeps the dynamic linker from lazily linking symbols.
Question: I have questions. post your questions to this newsgroup: news://news.mozilla.org/netscape.public.mozilla.unix If you are trying to debug Mozilla on UNIX, we'll gladly help. Question: I have comments. post your constructive comments to this newsgroup: news://news.mozilla.org/netscape.public.mozilla.unix whining will be ignored. Question: I want to add to this FAQ. Who I send my additions to? post your additions to this newsgroup: news://news.mozilla.org/netscape.public.mozilla.unix or send mail to sspitzer@netscape.com. |
|||||||
| Copyright © 1998-1999 The Mozilla Organization. | |||||||