🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1997

Re: c++ strings with gdb??

#1997
From: Michael Elizabeth Chastain
Date: Sun, 26 May 2002 23:40
21 lines
1569 bytes
Hi Eric,

> I have tried the examine the memory. I got '<' when using "x/c
> 0x24340" but got "<A HREF=\"http:/" when using "x/s 0x24340".

Okay.  Now try "x/c 0x24341", "x/c 0x24342", and so on.
Or you can just hit the carriage return after the first one.

> I tried to use "cout" and "cerr" to print the content(s) of "substring"
> and I got expected '<'.

That's dicey, it doesn't work for me even with gdb 5.2.
Maybe someday it will.  :-/

> I suspect the string does not end with null char. So, gdb overshots
> when it tries to print out the contents of the string.

That's likely.  You'll have to look at the header file for the string
class and figure out the data representation.

Michael C
Technical Details
Message-ID: <200205262340.g4QNeuQ25835@duracef.shout.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,cf4f7284ed0c741e,start
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-05-26 16:41:05 PST
x-uunet-gateway: chi6sosrv13.alter.net from bug-gdb to gnu.gdb.bug; Sun, 26 May 2002 23:41:05 GMT
Date: Sun, 26 May 2002 18:40:56 -0500
From: mec@shout.net (Michael Elizabeth Chastain)
Message-ID: <200205262340.g4QNeuQ25835@duracef.shout.net>
Subject: Re: c++ strings with gdb??
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!sn-xit-01!supernews.com!207.217.77.43.MISMATCH!newsfeed1.earthlink.net!newsfeed.earthlink.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!uunet!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
Sender: bug-gdb-request@mail.gnu.org
Lines: 21