From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15238 invoked by alias); 6 Sep 2009 15:03:50 -0000 Received: (qmail 15094 invoked by uid 22791); 6 Sep 2009 15:03:49 -0000 X-SWARE-Spam-Status: No, hits=-0.3 required=5.0 tests=AWL,BAYES_50,J_CHICKENPOX_13,J_CHICKENPOX_43,J_CHICKENPOX_62,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: sourceware.org Received: from michael.checkpoint.com (HELO michael.checkpoint.com) (194.29.32.68) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 Sep 2009 15:03:43 +0000 Received: from il-ex01.ad.checkpoint.com (localhost [127.0.0.1]) by michael.checkpoint.com (8.12.10+Sun/8.12.10) with ESMTP id n86F3d3P001818 for ; Sun, 6 Sep 2009 18:03:40 +0300 (IDT) Received: from il-ex01.ad.checkpoint.com ([126.0.0.2]) by il-ex01.ad.checkpoint.com ([126.0.0.2]) with mapi; Sun, 6 Sep 2009 18:03:37 +0300 From: Avi Gozlan To: "gdb@sourceware.org" CC: Avi Gozlan Date: Sun, 06 Sep 2009 15:03:00 -0000 Subject: SIGTRAP recieved while trying to call C function from GDB Message-ID: <9C4E85B61203CD419BB3A638E5F68333D2F050FD81@il-ex01.ad.checkpoint.com> Content-Type: text/plain; charset="windows-1255" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00107.txt.bz2 Hello, We get SIGTRAP when trying to call C functions in GDB prompt. Following is = an example program: #include class A{ public: =A0 A() {} }; int main(int argc, char **argv) { =A0 A *a =3D new A; =A0 printf("hello, world\n"); } Scenario: 1. Run gdb a.out=20 2. b main=20 3. r=20 4. n (GDB stops prior to the printf() call)=20 5. p atoi(=931=94)=20 (gdb) p atoi(=931=94) 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 aband= oned. (gdb) This does not happen if calling =91p atoi(=931=94)=92 immediately when runn= ing 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 =96g =96l stdc++ =A0=A0myprog.cc Thanks, Avi