Article View: gnu.gdb.bug
Article #1948Re: c++ strings with gdb??
From: Michael Elizabeth Chastain
Date: Fri, 17 May 2002 17:15
Date: Fri, 17 May 2002 17:15
22 lines
1635 bytes
1635 bytes
Hi Eric, Presumably, your string actually has that many characters in it. I would suggest looking directly at the memory: (gdb) x/c 0x24340 ... then hit the "return" key to see successive characters Your C++ string class doesn't have any field named "length" so it probably uses null-terminated characters. > For refereence to my first post, this string should > have only "<", without those trailling chars. Well, either gdb is lying, or we are mis-interpreting its output, or your string really does all those characters in it. I recommend trying some different things, such as different data display commands in gdb, and perhaps adding some printf statements to the program (i know, icky) to see the data independently of gdb. Michael C
Technical Details
Message-ID:
<200205171715.g4HHF5o11057@duracef.shout.net>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!192.50.8.47.MISMATCH!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!osa.uu.net!sea.uu.net!sac.uu.net!dfw.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdbShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f5053,3b612bd1c1e2d578 X-Google-Attributes: gidf5053,public X-Google-ArrivalTime: 2002-05-17 10:15:25 PST x-uunet-gateway: sjc3sosrv11.alter.net from bug-gdb to gnu.gdb.bug; Fri, 17 May 2002 17:15:16 GMT Date: Fri, 17 May 2002 12:15:05 -0500 From: mec@shout.net (Michael Elizabeth Chastain) Message-ID: <200205171715.g4HHF5o11057@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!newsfeed.berkeley.edu!news-hog.berkeley.edu!ucberkeley!192.50.8.47.MISMATCH!newsfeed.media.kyoto-u.ac.jp!newsfeed.mesh.ad.jp!osa.uu.net!sea.uu.net!sac.uu.net!dfw.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb Sender: bug-gdb-request@mail.gnu.org Lines: 22