For easy tracing of threads we have a patch for gdb 4.18 and 5.0 (a new command) and a gdb sequence (think script).
The sequence only works for i386, but its just matter of choosing different offset in topstack to find $fp and $pc in the lwp_ps_internal part of the sequence.
The gdb built from the patched sources can be started like this:
[root /usr/src]# gdb-backfrom -x arla/arlad/.gdbinit /usr/arla/bin/arlad core
Your debugging session might look like this:
(gdb) lwp_ps Runnable[0] name: IO MANAGER eventlist: fp: 0x806aac4 pc: 0x806aac4 name: producer eventlist: 8048b00 fp: 0x8083b40 pc: 0x8083b40 Runnable[1] [...] (gdb) help backfrom Print backtrace of FRAMEPOINTER and PROGRAMCOUNTER. (gdb) backfrom 0x8083b40 0x8083b40 #0 0x8083b40 in ?? () #1 0x8049e2f in LWP_MwaitProcess (wcount=1, evlist=0x8083b70) at /afs/e.kth.se/home/staff/lha/src/cvs/arla-foo/lwp/lwp.c:567 #2 0x8049eaf in LWP_WaitProcess (event=0x8048b00) at /afs/e.kth.se/home/staff/lha/src/cvs/arla-foo/lwp/lwp.c:585 #3 0x8048b12 in Producer (foo=0x0) at /afs/e.kth.se/home/staff/lha/src/cvs/arla-foo/lwp/testlwp.c:76 #4 0x804a00c in Create_Process_Part2 () at /afs/e.kth.se/home/staff/lha/src/cvs/arla-foo/lwp/lwp.c:629 #5 0xfffefdfc in ?? () #6 0x8051980 in ?? ()
There also the possibility to run arla with pthreads (run configure with --with-pthreads).
[Back]$Id: gdb.html,v 1.3 2003/01/22 11:24:30 lha Exp $