From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31893 invoked by alias); 6 Sep 2009 15:13:46 -0000 Received: (qmail 31885 invoked by uid 22791); 6 Sep 2009 15:13:46 -0000 X-SWARE-Spam-Status: No, hits=-0.8 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_13,J_CHICKENPOX_43,J_CHICKENPOX_62,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f196.google.com (HELO mail-pz0-f196.google.com) (209.85.222.196) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 Sep 2009 15:13:37 +0000 Received: by pzk34 with SMTP id 34so457655pzk.25 for ; Sun, 06 Sep 2009 08:13:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.7.10 with SMTP id 10mr453198wfg.137.1252250014046; Sun, 06 Sep 2009 08:13:34 -0700 (PDT) In-Reply-To: <9C4E85B61203CD419BB3A638E5F68333D2F050FD81@il-ex01.ad.checkpoint.com> References: <9C4E85B61203CD419BB3A638E5F68333D2F050FD81@il-ex01.ad.checkpoint.com> From: Hui Zhu Date: Sun, 06 Sep 2009 15:13:00 -0000 Message-ID: Subject: Re: SIGTRAP recieved while trying to call C function from GDB To: Avi Gozlan Cc: "gdb@sourceware.org" Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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/msg00108.txt.bz2 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=3D During symbol reading, incomplete CFI data; unspecified registers (e.g., rax) at 0x400655. 1, argv=3D0x7fffffffe3b8) at 2.c:10 10 A *a =3D 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 =3D 1 Thanks, Hui 2009/9/6 Avi Gozlan : > Hello, > > We get SIGTRAP when trying to call C functions in GDB prompt. Following i= s 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 > 2. b main > 3. r > 4. n (GDB stops prior to the printf() call) > 5. p atoi(=931=94) > > (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 G= DB. > 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 aba= ndoned. > (gdb) > > This does not happen if calling =91p atoi(=931=94)=92 immediately when ru= nning 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 > >