Using gdb Is there anyway to check the stack before the call to abort then raise

shanevolpe@gmail.com shanevolpe@gmail.com
Tue Feb 27 19:50:00 GMT 2007


Is there anyway to check the stack before the call to abort then raise?
I tried setting a break point on raise, but I only get a few more
lines in the backtrace that do not lead me to the spot in my program
that caused the error.

This was run with MALLOC_CHECK_=2
compiled with -g -rdynamic


Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1154159760 (LWP 4162)] 0x00000000 in ?? ()
(gdb) backtrace 20
#0  0x00000000 in ?? ()
#1  0x00013c80 in Audio::BackgroundThreadFunction (this=0x499c0) at
/home/richardr/wcd3100l/arm/lifecor/apps/shell/src/audio.cpp:485
#2  0x00013f20 in BackgroundAudioThread (arg=0x499c0) at
/home/richardr/wcd3100l/arm/lifecor/apps/shell/src/audio.cpp:605
#3  0x4035aa6c in start_thread () from /lib/libpthread.so.0
#4  0x4041a198 in clone () from /lib/libc.so.6 Backtrace stopped:
frame did not save the PC
(gdb) info threads
  126 Thread 1215325328 (LWP 4289)  0x40404d7c in sched_yield () from
/lib/libc.so.6
  20 Thread 1223713936 (LWP 4176)  0x40404d7c in sched_yield () from
/lib/libc.so.6
  18 Thread 1205945488 (LWP 4174)  0x40362c54 in accept () from
/lib/libpthread.so.0
  17 Thread 1197556880 (LWP 4173)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  16 Thread 1188361360 (LWP 4172)  0x403629a4 in read () from
/lib/libpthread.so.0
  15 Thread 1179935888 (LWP 4169)  0x403629a4 in read () from
/lib/libpthread.so.0
  14 Thread 1171547280 (LWP 4168)  0x403629a4 in read () from
/lib/libpthread.so.0
  13 Thread 1162626192 (LWP 4167)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
* 12 Thread 1154159760 (LWP 4162)  0x00000000 in ?? ()
  11 Thread 1137185936 (LWP 4161)  0x4035d108 in pthread_mutex_lock ()
from /lib/libpthread.so.0
  10 Thread 1145574544 (LWP 4160)  0x403ee074 in nanosleep () from
/lib/libc.so.6
  7 Thread 1128797328 (LWP 4150)  0x40404d7c in sched_yield () from
/lib/libc.so.6
  6 Thread 1120408720 (LWP 4149)  0x403ee074 in nanosleep () from
/lib/libc.so.6
  5 Thread 1112020112 (LWP 4148)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  4 Thread 1103631504 (LWP 4147)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  3 Thread 1095242896 (LWP 4146)  0x403629a4 in read () from
/lib/libpthread.so.0
  2 Thread 1086854288 (LWP 4145)  0x40363e90 in do_sigwait () from
/lib/libpthread.so.0
  1 Thread 1073871200 (LWP 4144)  0x403ee074 in nanosleep () from
/lib/libc.so.6

I received the above backtrace after an error occured in my program.
Why cant GDB determine the last function call (if I did not word this
right, I appologize, I am looking for an explanation for why #0 is
0x000000000 in ??).  Is there anyway to catch this info.


===============================================================================

*** glibc detected *** /lifecor/shell: double free or corruption
(!prev): 0x000e8368 ***

Program received signal SIGABRT, Aborted.
[Switching to Thread 1224766608 (LWP 3149)]
0x4039aa24 in raise () from /lib/libc.so.6
(gdb) df
Undefined command: "df".  Try "help".
(gdb) top
Undefined command: "top".  Try "help".
(gdb) bt
#0  0x4039aa24 in raise () from /lib/libc.so.6
#1  0x4039bd5c in abort () from /lib/libc.so.6 Backtrace stopped:
frame did not save the PC
(gdb) info threads
  353 Thread 1241867408 (LWP 3482)  0x4035fed4 in
pthread_cond_timedwait@@GLIBC_2.4 () from /lib/libpthread.so.0
* 20 Thread 1224766608 (LWP 3149)  0x4039aa24 in raise () from
/lib/libc.so.6
  18 Thread 1206998160 (LWP 3147)  0x40362c54 in accept () from
/lib/libpthread.so.0
  17 Thread 1198609552 (LWP 3146)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  16 Thread 1189414032 (LWP 3145)  0x403629a4 in read () from
/lib/libpthread.so.0
  15 Thread 1180988560 (LWP 3142)  0x403629a4 in read () from
/lib/libpthread.so.0
  14 Thread 1172599952 (LWP 3141)  0x403629a4 in read () from
/lib/libpthread.so.0
  13 Thread 1163916432 (LWP 3140)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  12 Thread 1155527824 (LWP 3135)  0x403ee074 in nanosleep () from
/lib/libc.so.6
  11 Thread 1137185936 (LWP 3134)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  10 Thread 1145574544 (LWP 3133)  0x403ee074 in nanosleep () from
/lib/libc.so.6
  7 Thread 1128797328 (LWP 3123)  0x40404d7c in sched_yield () from
/lib/libc.so.6
  6 Thread 1120408720 (LWP 3122)  0x403ee074 in nanosleep () from
/lib/libc.so.6
  5 Thread 1112020112 (LWP 3121)  0x4035fed4 in
pthread_cond_timedwait@@GLIBC_2.4 () from /lib/libpthread.so.0
  4 Thread 1103631504 (LWP 3120)  0x4035fbdc in
pthread_cond_wait@@GLIBC_2.4 () from /lib/libpthread.so.0
  3 Thread 1095242896 (LWP 3119)  0x403629a4 in read () from
/lib/libpthread.so.0
  2 Thread 1086854288 (LWP 3118)  0x40363e90 in do_sigwait () from
/lib/libpthread.so.0
  1 Thread 1073871200 (LWP 3117)  0x403ee074 in nanosleep () from
/lib/libc.so.6
(gdb) quit



More information about the Gdb mailing list