Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Display content of unicode std::wstring objects
@ 2008-08-15 18:26 Fredrik Orderud
  2008-08-15 20:04 ` Paul Pluzhnikov
  0 siblings, 1 reply; 2+ messages in thread
From: Fredrik Orderud @ 2008-08-15 18:26 UTC (permalink / raw)
  To: gdb

Is there any in-build support for displaying the content of C++ STL unicode 
text-strings in gdb?

In my C++ program I have a lot of std::wstring objects, and I want a 
convenient way to display the content of these unicode strings from gdb 
whenever I break my program. Currently, I just dump the content of the 
memory area manually with "x/20c str_obj._M_dataplus._M_p" (for a 
"std::wstring str_obj" object), but this is inconvenient due to the 
"_M_dataplus._M_p" subfields and results in a very verbose listing. You also 
need to know the string length in advance with this approach.

On my machine I run Fedora linux 9, with gcc/g++ 4.3.0 and gdb 6.8.

Thanks in advance
Fredrik Orderud 


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Display content of unicode std::wstring objects
  2008-08-15 18:26 Display content of unicode std::wstring objects Fredrik Orderud
@ 2008-08-15 20:04 ` Paul Pluzhnikov
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Pluzhnikov @ 2008-08-15 20:04 UTC (permalink / raw)
  To: Fredrik Orderud; +Cc: gdb

On Fri, Aug 15, 2008 at 6:12 AM, Fredrik Orderud
<fredrik.orderud@idi.ntnu.no> wrote:

> Is there any in-build support for displaying the content of C++ STL unicode
> text-strings in gdb?

No, but Python scripting work (happening right now) is supposed to address this.

In the mean time, you may want to try this patch:
http://sourceware.org/ml/gdb-patches/2008-08/msg00167.html

It claims to allow this:

(gdb) p z
(std::wstring) L"This is a wide string."


Cheers,
-- 
Paul Pluzhnikov


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-15 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-15 18:26 Display content of unicode std::wstring objects Fredrik Orderud
2008-08-15 20:04 ` Paul Pluzhnikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox