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. Fix: 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. How-To-Repeat: Simple test code: #include <stdio.h> #include <objc/objc.h> #include <objc/objc-api.h> #include <objc/Object.h> int main(int argc, char *argv[]) { id my_test = [Object new]; [my_test a_missing_method]; return 0; } Compile with "cc -g test.m -lobj -lpthread" and run under gdb. Compiling with "cc -g test.m -lobj -lthr" behaves as expected.
A bit more info - this problem seems to be related to the scope of the threads as if I run the test program with LIBPTHREAD_SYSTEM_SCOPE defined then the debugger catches the abort correctly and lets me trace the offending method call.
libkse is no longer supported and libthr is the only threading library used by modern versions of FreeBSD.
Heh, indeed! In addition modern FreeBSD has no objective c runtime and doesnt have the GNU compiler, so all kind of moot! Thanks for looking through. I do wonder what it was, however.