threads/110636: using gdb with multi thread application with lib libpthread

Mikhail Modin Mihail.Modin at
Wed Mar 21 18:20:06 UTC 2007

>Number:         110636
>Category:       threads
>Synopsis:       using gdb with multi thread application with lib libpthread
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-threads
>State:          open
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Mar 21 18:20:03 GMT 2007
>Originator:     Mikhail Modin
>Release:        FreeBSD 5.5
Kaspersky Lab
FreeBSD some.hostname 5.5-RELEASE FreeBSD 5.5-RELEASE #0: Tue May 23 14:58:27 UTC 2006     root at  i386
It`s imposable analyze core dump files from multi thread application linked with libpthread. 

For example, we have application with have 4 threads. 3 of them are in runnable state, one of them generate SIGSEGV. How do I can detect it thread?

#0  0x280e1373 in pthread_testcancel () from /usr/lib/
(gdb) i threads
* 6 LWP 100066  0x280e1373 in pthread_testcancel ()
   from /usr/lib/
  5 Thread 5 (sleeping)  0x280d9233 in pthread_mutexattr_init ()
   from /usr/lib/
  4 Thread 4 (LWP 100142)  0x280e1353 in pthread_testcancel ()
   from /usr/lib/
  3 Thread 3 (runnable)  0x280f70d4 in sin () from /lib/
  2 Thread 2 (runnable)  f (f=0x0) at thread_sigsegv_test.cpp:23
  1 Thread 1 (runnable)  0x280f70d2 in sin () from /lib/
(gdb) t 5
[Switching to thread 5 (Thread 5 (sleeping))]#0  0x280d9233 in pthread_mutexattr_init () from /usr/lib/
(gdb) bt
#0  0x280d9233 in pthread_mutexattr_init () from /usr/lib/
#1  0x280d9195 in pthread_mutexattr_init () from /usr/lib/
#2  0x280cc7b2 in pthread_join () from /usr/lib/
#3  0x0806127c in main () at thread_sigsegv_test.cpp:39
(gdb) t 4
[Switching to thread 4 (Thread 4 (LWP 100142))]#0  0x280e1353 in pthread_testcancel () from /usr/lib/
(gdb) bt
#0  0x280e1353 in pthread_testcancel () from /usr/lib/
#1  0x280d992e in pthread_mutexattr_init () from /usr/lib/
#2  0x00000000 in ?? ()
It`s very easy. :)
I don`t know.

More information about the freebsd-threads mailing list