threads/80992: abort() sometimes not caught by gdb depending on
petefrench at ticketswitch.com
Fri May 13 10:40:02 PDT 2005
>Synopsis: abort() sometimes not caught by gdb depending on thread library
>Arrival-Date: Fri May 13 17:40:02 GMT 2005
>Originator: Pete French
>Release: FreeBSD 5.4-RELEASE i386
System: FreeBSD dilbert.rattatosk 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Tue May 10 14:15:25 BST 2005 petefrench at dilbert.rattatosk:/usr/obj/usr/src/sys/P4-SMP-WORKSTATION i386
When an unknown method is called in /usr/lib/libobjc.a it
calls abort() to halt the program with a SIGABRT. Running
such a program under gdb should then allow you to trace the
point of the call.
If the program is linked with -lthr then this works. If it
is linked with -lpthread then this does not work, and gdb
says "The program no longer exists."
This works on FreeBSD 4 and all other operating systems I
have tried it on. It also works, as stated, with libthr
on FreeBSD 5. The problem seems to be specific to libpthread
This has only shown up when trying to debug threaded code,
but the fact it is specific to a thread library and that
the code behaves everywhere else makes me wonder if something more
sinister is going on inside pthread.
Simple test code:
main(int argc, char *argv)
id my_test = [Object new];
Compile with "cc -g test.m -lobj -lpthread" and run under gdb.
Compiling with "cc -g test.m -lobj -lthr" behaves as expected.
This is only an issue when debugging, and if I need to track
down a bad method call I can always compile and run with libthr
in order to find it. Annoying but not the end of the world.
More information about the freebsd-threads