Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 28 Jan 2008 19:09:51 GMT
From:      Christoph Mallon <christoph.mallon@gmx.de>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   kern/120095: gdb fails to catch signals when threading is involved
Message-ID:  <200801281909.m0SJ9p8H006153@www.freebsd.org>
Resent-Message-ID: <200801281920.m0SJK2KK060376@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         120095
>Category:       kern
>Synopsis:       gdb fails to catch signals when threading is involved
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 28 19:20:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Christoph Mallon
>Release:        RELENG_6_2 (applies to newer releases, including 8.x, too)
>Organization:
-
>Environment:
FreeBSD tron.homeunix.org 6.2-STABLE FreeBSD 6.2-STABLE #1: Sun Aug 26 08:02:41 CEST 2007     root@tron.homeunix.org:/usr/obj/usr/src/sys/KERNEL  i386
>Description:
GDB is not able to catch signals from threaded processes, even if no extra threads get created. According to rwatson@ this is probably a kernel-side signal handling problem and he can reproduce this on 8.x, too (though instead of -pthread he used -lkse, because the standard threading implementation was changed).

Building the test program below with the different thread libraries gives the following results:

[WORKS] no threading: (cc -ggdb test.c)
(gdb) r
Starting program: /usr/home/tron/a.out 

Program received signal SIGABRT, Aborted.
0x2814cc47 in kill () from /lib/libc.so.6
(gdb)


[BROKEN] pthread (KSE on my 6.x box): (cc -ggdb -pthread test.c)
(gdb) r
Starting program: /usr/home/tron/a.out 
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100103]

Program exited normally.
(gdb)


[WORKS] libthr: (cc -ggdb -lthr test.c)
(gdb) r
Starting program: /usr/home/tron/a.out 
[New LWP 100118]
[New Thread 0x804b000 (LWP 100118)]

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x804b000 (LWP 100118)]
0x2815fc47 in kill () from /lib/libc.so.6
(gdb)


[BROKEN] libc_r: (cc -ggdb -lc_r test.c)
(gdb) r
Starting program: /usr/home/tron/a.out 
warning: Unable to get location for thread creation breakpoint: generic error
[New LWP 100185]
Cannot find thread, Thread ID=1, generic error
(gdb)
>How-To-Repeat:
#include <sys/types.h>
#include <signal.h>
#include <unistd.h>
int main(void) { kill(getpid(), SIGABRT); }
>Fix:


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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200801281909.m0SJ9p8H006153>