From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17626 invoked by alias); 2 Apr 2004 13:26:09 -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 17616 invoked from network); 2 Apr 2004 13:26:05 -0000 Received: from unknown (HELO lakemtao01.cox.net) (68.1.17.244) by sources.redhat.com with SMTP; 2 Apr 2004 13:26:05 -0000 Received: from white ([68.9.64.121]) by lakemtao01.cox.net (InterMail vM.5.01.06.08 201-253-122-130-108-20031117) with ESMTP id <20040402132604.PNYF26108.lakemtao01.cox.net@white>; Fri, 2 Apr 2004 08:26:04 -0500 Received: from bob by white with local (Exim 3.35 #1 (Debian)) id 1B9OgQ-00087n-00; Fri, 02 Apr 2004 08:26:06 -0500 Date: Fri, 02 Apr 2004 13:26:00 -0000 From: Bob Rossi To: Holger Sesterhenn Cc: gdb@sources.redhat.com Subject: Re: Problem debugging statically linked c++ program with GDB 6.0 Message-ID: <20040402132605.GA31210@white> Mail-Followup-To: Holger Sesterhenn , gdb@sources.redhat.com References: <406D578A.6010408@smgwtest.aachen.utimaco.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <406D578A.6010408@smgwtest.aachen.utimaco.de> User-Agent: Mutt/1.3.28i X-SW-Source: 2004-04/txt/msg00011.txt.bz2 On Fri, Apr 02, 2004 at 02:07:38PM +0200, Holger Sesterhenn wrote: > Hi, > > I have a bug in my statically linked c++ program and would like to use > DDD with GDB to see whats wrong. I use from the stdlibc++. > DDD/GDB shows a SIGSGV if I call a member function e.g. c_str() to take > a look at the value of the string. > > I have written a little program to reproduce the problem (don't need > DDD). If the program is linked dynamically, everything works as expected! > > If somebody can confirm the problem I would submit a bug report. > Searching the bug database I did not find any hint. > > Running Linux 2.4.21 (IA86/32), compiled gcc 3.3.3, glibc 2.3.2 and gdb > 6.0 myself (chrooted). The problem can be reproduced with a plain SuSE > 9.0 installation (gcc 3.3.1, glibc 2.3.2, gdb 5.3.92). I don't know if this is helpful, however, GDB crashes for me even when I link dynamically. It will only evaluate the expression sometimes for me. Because of this, I have added the snippet below to my .gdbinit file # prints a C++ string define pc set $string_length=$arg0.length() set print elements $string_length print $arg0.dat set print elements 0 end document pc Prints a C++ string end This seems to work ok, even though it's not the perfect solution. For some reason calling the length() function never seems to crash for me. Bob Rossi