From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15564 invoked by alias); 27 Feb 2003 18:04:30 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 15545 invoked from network); 27 Feb 2003 18:04:29 -0000 Received: from unknown (HELO tomts11-srv.bellnexxia.net) (209.226.175.55) by 172.16.49.205 with SMTP; 27 Feb 2003 18:04:29 -0000 Received: from sympatico.ca ([65.94.70.23]) by tomts11-srv.bellnexxia.net (InterMail vM.5.01.04.19 201-253-122-122-119-20020516) with ESMTP id <20030227180428.FFVU2002.tomts11-srv.bellnexxia.net@sympatico.ca> for ; Thu, 27 Feb 2003 13:04:28 -0500 Message-ID: <3E5FA468.8090008@sympatico.ca> Date: Thu, 27 Feb 2003 18:04:00 -0000 From: jacques User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030113 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb@sources.redhat.com Subject: Problems outputting a string References: <3E5E3F0D.1080308@redhat.com> In-Reply-To: <3E5E3F0D.1080308@redhat.com> X-Enigmail-Version: 0.71.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 8bit X-SW-Source: 2003-02/txt/msg00585.txt.bz2 Hello I'm having problems with my program. I've always been able to see strings with gdb, but now I can't! Here's my source: #include #include using namespace std; string foo(){ string ret; ret = "lal"; return ret; //> = {}, _M_p = 0xbffff7a0 "l\234\004\ba"+$@?¡Ây"??\205\004\bT_\022@a"+$@?¡Ây"?d\n\023@\001"}, static _S_empty_rep_storage = {0, 0, 0, 0}} (gdb) p ret.c_str() Program received signal SIGSEGV, Segmentation fault. 0x400acf3c in std::char_traits::assign(char&, char const&) () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.1/libstdc++.so.5 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 (std::string::c_str() const) will be abandoned. (gdb) Here are my compiler flags: -ggdb -O0 -fno-inline g++ version: bash-2.05b$ g++ --version g++ (GCC) 3.2.1 20021207 (Gentoo Linux 3.2.1-20021207) gdb version: bash-2.05b$ gdb --version GNU gdb 5.3 any suggestions? --Jacques