* SIGTRAP recieved while trying to call C function from GDB
@ 2009-09-06 15:03 Avi Gozlan
2009-09-06 15:13 ` Hui Zhu
2009-09-06 15:26 ` Daniel Jacobowitz
0 siblings, 2 replies; 5+ messages in thread
From: Avi Gozlan @ 2009-09-06 15:03 UTC (permalink / raw)
To: gdb; +Cc: Avi Gozlan
Hello,
We get SIGTRAP when trying to call C functions in GDB prompt. Following is an example program:
#include <stdio.h>
class A{
public:
A() {}
};
int main(int argc, char **argv)
{
A *a = new A;
printf("hello, world\n");
}
Scenario:
1. Run gdb a.out
2. b main
3. r
4. n (GDB stops prior to the printf() call)
5. p atoi(“1”)
(gdb) p atoi(“1”)
Program received signal SIGTRAP, Trace/breakpoint trap.
0x004b7411 in malloc () from /lib/ld-linux.so.2
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 (malloc) will be abandoned.
(gdb)
This does not happen if calling ‘p atoi(“1”)’ immediately when running the program or following the printf() function call.
GDB version: 6.8
Linux Release: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
Kernel version: 2.6.18-53.1.13.el5PAE
Compiler: either gcc 4.1.2 20070626 or gcc 3.2.3 20030502
Compilation command: gcc –g –l stdc++ myprog.cc
Thanks,
Avi
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SIGTRAP recieved while trying to call C function from GDB
2009-09-06 15:03 SIGTRAP recieved while trying to call C function from GDB Avi Gozlan
@ 2009-09-06 15:13 ` Hui Zhu
2009-09-06 15:26 ` Daniel Jacobowitz
1 sibling, 0 replies; 5+ messages in thread
From: Hui Zhu @ 2009-09-06 15:13 UTC (permalink / raw)
To: Avi Gozlan; +Cc: gdb
I cannot reproduce this issue in gdb-cvs-head. AMD64 UBUNTU
(gdb) start
During symbol reading, DW_AT_name missing from DW_TAG_base_type.
Temporary breakpoint 1 at 0x40065c: file 2.c, line 10.
Starting program: /home/teawater/gdb/rec/bgdbno/gdb/a.out
Temporary breakpoint 1, main (argc=
During symbol reading, incomplete CFI data; unspecified registers
(e.g., rax) at 0x400655.
1, argv=0x7fffffffe3b8) at 2.c:10
10 A *a = new A;
Current language: auto
The current source language is "auto; currently c++".
(gdb) n
12 printf("hello, world\n");
(gdb) p atoi("1")
$1 = 1
Thanks,
Hui
2009/9/6 Avi Gozlan <avi@checkpoint.com>:
> Hello,
>
> We get SIGTRAP when trying to call C functions in GDB prompt. Following is an example program:
>
> #include <stdio.h>
>
> class A{
> public:
> A() {}
> };
>
> int main(int argc, char **argv)
> {
> A *a = new A;
>
> printf("hello, world\n");
> }
>
> Scenario:
> 1. Run gdb a.out
> 2. b main
> 3. r
> 4. n (GDB stops prior to the printf() call)
> 5. p atoi(“1”)
>
> (gdb) p atoi(“1”)
>
> Program received signal SIGTRAP, Trace/breakpoint trap.
> 0x004b7411 in malloc () from /lib/ld-linux.so.2
> 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 (malloc) will be abandoned.
> (gdb)
>
> This does not happen if calling ‘p atoi(“1”)’ immediately when running the program or following the printf() function call.
>
> GDB version: 6.8
> Linux Release: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
> Kernel version: 2.6.18-53.1.13.el5PAE
> Compiler: either gcc 4.1.2 20070626 or gcc 3.2.3 20030502
> Compilation command: gcc –g –l stdc++ myprog.cc
>
> Thanks,
>
> Avi
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: SIGTRAP recieved while trying to call C function from GDB
2009-09-06 15:03 SIGTRAP recieved while trying to call C function from GDB Avi Gozlan
2009-09-06 15:13 ` Hui Zhu
@ 2009-09-06 15:26 ` Daniel Jacobowitz
2009-09-08 10:31 ` Avi Gozlan
1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2009-09-06 15:26 UTC (permalink / raw)
To: Avi Gozlan; +Cc: gdb
On Sun, Sep 06, 2009 at 06:03:37PM +0300, Avi Gozlan wrote:
> GDB version: 6.8
> Linux Release: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
> Kernel version: 2.6.18-53.1.13.el5PAE
Is this the latest RHEL kernel? I believe this was a known kernel
fault around the 2.6.18 era.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: SIGTRAP recieved while trying to call C function from GDB
2009-09-06 15:26 ` Daniel Jacobowitz
@ 2009-09-08 10:31 ` Avi Gozlan
2009-09-08 19:21 ` Jan Kratochvil
0 siblings, 1 reply; 5+ messages in thread
From: Avi Gozlan @ 2009-09-08 10:31 UTC (permalink / raw)
To: gdb
Indeed this is not the latest RHEL kernel. It happens on RHEL 5.1
Thanks,
Avi
-----Original Message-----
From: Daniel Jacobowitz [mailto:drow@false.org]
Sent: Sunday, September 06, 2009 6:26 PM
To: Avi Gozlan
Cc: gdb@sourceware.org
Subject: Re: SIGTRAP recieved while trying to call C function from GDB
On Sun, Sep 06, 2009 at 06:03:37PM +0300, Avi Gozlan wrote:
> GDB version: 6.8
> Linux Release: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
> Kernel version: 2.6.18-53.1.13.el5PAE
Is this the latest RHEL kernel? I believe this was a known kernel
fault around the 2.6.18 era.
--
Daniel Jacobowitz
CodeSourcery
Scanned by Check Point Total Security Gateway.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: SIGTRAP recieved while trying to call C function from GDB
2009-09-08 10:31 ` Avi Gozlan
@ 2009-09-08 19:21 ` Jan Kratochvil
0 siblings, 0 replies; 5+ messages in thread
From: Jan Kratochvil @ 2009-09-08 19:21 UTC (permalink / raw)
To: Avi Gozlan; +Cc: gdb
> From: Daniel Jacobowitz [mailto:drow@false.org]
> On Sun, Sep 06, 2009 at 06:03:37PM +0300, Avi Gozlan wrote:
> > Linux Release: Red Hat Enterprise Linux Server release 5.1 (Tikanga)
> > Kernel version: 2.6.18-53.1.13.el5PAE
>
> Is this the latest RHEL kernel? I believe this was a known kernel
> fault around the 2.6.18 era.
On Tue, 08 Sep 2009 12:31:11 +0200, Avi Gozlan wrote:
> Indeed this is not the latest RHEL kernel. It happens on RHEL 5.1
Just a confirmation RHEL-5.1 ptrace in kernel is known it had issues primarily
visible with GDB. It was fixed in general by the RHEL-5.2 kernel.
Sure I would like to recommend the latest RHEL-5.4 instead now having
backported also various ptrace fixes being done upstream.
Thanks,
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-08 19:21 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-06 15:03 SIGTRAP recieved while trying to call C function from GDB Avi Gozlan
2009-09-06 15:13 ` Hui Zhu
2009-09-06 15:26 ` Daniel Jacobowitz
2009-09-08 10:31 ` Avi Gozlan
2009-09-08 19:21 ` Jan Kratochvil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox