This is the mail archive of the
gdb@sources.redhat.com
mailing list for the GDB project.
Re: help: gdb and c++ strings
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Murad Nayal <mn216 at columbia dot edu>
- Cc: gdb at sources dot redhat dot com
- Date: Thu, 5 Dec 2002 23:16:12 -0500
- Subject: Re: help: gdb and c++ strings
- References: <3DF02150.AACFAEB7@columbia.edu>
On Thu, Dec 05, 2002 at 11:02:24PM -0500, Murad Nayal wrote:
>
>
> Hello,
>
> I am wondering if anyone here can help me with this. I am porting code
> to linux and trying to use gdb to do the debugging. unfortunately this
> is complicated by the fact that gdb does not print c++ string variables.
>
> p s
> $1 = (
> const basic_string<char,std::char_traits<char>,std::allocator<char>
> > &) @0xbffff3d0: {static npos = Cannot access memory at address 0x8f4b974
>
> I have come upon an older post to bug-gdb list that mentions this
> problem
> http://sources.redhat.com/ml/bug-gdb/2000-09/msg00012.html
>
> in response Daniel Berlin suggested that this problem might be related
> to the stabs format and that using dwarf-2 format (i.e. g++ -gdwarf-2)
> would solve it. however it was mentioned back then that for large
> programs this problem persists even when compiling with the -gdwarf-2
> flag. this is where I am at right now. I have recompiled gdb from
> sources (5.2.1) and recompiled most of the libraries I am using
> (including the objects I am trying to debug) using the -gdwarf-2 flag. I
> am on a pentium 3 platform using g++ 3.2.1, also compiled from sources.
> I am not sure what to try next. can you help?
You need to get a newer snapshot of GDB. This bug was fixed only a
couple of weeks ago, IIRC.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer