threads/80992: abort() sometimes not caught by gdb depending on thread library

Pete French petefrench at ticketswitch.com
Fri May 13 10:40:02 PDT 2005


>Number:         80992
>Category:       threads
>Synopsis:       abort() sometimes not caught by gdb depending on thread library
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-threads
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri May 13 17:40:02 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Pete French
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
www.ticketswitch.com
>Environment:
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


	
>Description:
	

	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.

>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.

>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.

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-threads mailing list