Skip to contentSkip to conversation

2.6.24.3: unexpected SIGTRAP in gdb

DISCUSSION Dick Streefland 1 participant 1 message Mar 17, 2008

lore
Share & tools
lore
#0 lore raw

With kernel version 2.6.24.3, I sometimes get an unexpected SIGTRAP signal during the evaluation of a function call on the gdb command line. This problem does not occur with kernel version 2.6.23.12 running on the same machine. Both gdb-6.4.90 and gdb-6.7.1 exhibit this behavior.

I can reproduce the problem as follows:

$ cat > bug.c
int x;
int foo(void)
{
	return 42;
}
int main(int argc, char* argv[])
{
	x++;
	return 0;
}
^D
$ cat > bug.gdb
b main
r
s
p foo()
p foo()
^D
$ gcc -static -g -o bug bug.c
$ gdb -n -batch -x bug.gdb bug
Using host libthread_db library "/lib/tls/libthread_db.so.1".
Breakpoint 1 at 0x8048200: file bug.c, line 8.

Breakpoint 1, main () at bug.c:8
8 x++;
9 return 0;
$1 = 42

Program received signal SIGTRAP, Trace/breakpoint trap. 0x080481e9 in foo () at bug.c:3
3 {
/tmp/bug.gdb:5: Error in sourced command file:
The program being debugged was signaled while in a function called from GDB. GDB remains in the frame where the signal was received.
To change this behavior use "set unwindonsignal on"
Evaluation of the expression containing the function (foo) will be abandoned.

Signature · 3 lines
Dick Streefland                      ////                      Altium BV
[email protected]           (@ @)          http://www.altium.com
--------------------------------oOO--(_)--OOo---------------------------