From: Anton Kunze <ak@technosis.de>
Cc: gdb@sourceware.org
Subject: Re: Printing of strings with special characters
Date: Fri, 05 Mar 2010 08:33:00 -0000 [thread overview]
Message-ID: <4B90C17B.8020001@technosis.de> (raw)
In-Reply-To: <m34okw2c2g.fsf@fleche.redhat.com>
Hello Tom,
it doesn't work with charset UTF-32:
here is my test code:
-------------------------------------------------------
std::string strTest = "höhöhö";
const char* szTest = "höhöhö";
--------------------------------------------------------
my gdbinit:
---------------------------------------------------------
set target-charset UTF-32
set target-wide-charset UTF-32
set print pretty off
set print sevenbit-strings off
set print object on
---------------------------------------------------------
gdb console input/output:
---------------------------------------------------------------------------------------------------------
show print sevenbit-strings
Printing of 8-bit characters in strings as \nnn is on. // <----------this is weird
set print sevenbit-strings off
show print sevenbit-strings
Printing of 8-bit characters in strings as \nnn is off.
print strTest
$2 = {static npos = 4294967295, _M_dataplus = {<std::allocator<char>> ={<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No datafields>}, _M_p = 0x935dcd4 "\150\366\150", <incomplete sequence\366\150\366>}}
print szTest
$3 = 0x88db03a "\150\366\150", <incomplete sequence \366\150\366>
---------------------------------------------------------------------------------------------------------
UTF-16 doesn't work too.
best regards
Tom Tromey schrieb:
>>>>>> >>>>>> "Anton" == Anton Kunze <ak@technosis.de> writes:
>>>>>> >>>>>>
>>>>>>
> >
> > Anton> i'am using gdb 7.0.1 with python and pretty printing on suse linux. If I
> > Anton> try to print string with german special characters I get only strings as
> > Anton> '\nnn'.
> >
> > Anton> My gdbinit file contains following:
> > Anton> set charset ISO-8859-1
> > Anton> set target-wide-charset ISO-8859-1
> >
> > This is almost certainly wrong. You probably want `set
> > target-wide-charset UTF-32' -- which is the default on Linux. At least,
> > that will be what you want if your code is using wchar_t.
> >
> > Also, I recommend against using "set charset"; use target-charset
> > instead. 'set charset' sets the host charset in addition to the target
> > charset, but on systems with a decent locale implementation, you
> > basically will always want to use the result reported by the locale.
> >
> > Anton> sys.path.insert(0, '/home/anton/projects/debug/printers')
> >
> > Without the source to this we can't be completely sure about the
> > problem.
> >
> > Anton> Within my debug session I use the following commonds on gdb console:
> >
> > Anton> set print sevenbit-strings off
> > Anton> print qsHtml
> > Anton> $4 = "h\366h\366h\366"
> >
> > What type is a qsHtml? Specifically, what is the underlying character
> > type it uses?
> >
> > Tom
> >
> >
> >
>
Tom Tromey schrieb:
>>>>>> "Anton" == Anton Kunze <ak@technosis.de> writes:
>>>>>>
>
> Anton> i'am using gdb 7.0.1 with python and pretty printing on suse linux. If I
> Anton> try to print string with german special characters I get only strings as
> Anton> '\nnn'.
>
> Anton> My gdbinit file contains following:
> Anton> set charset ISO-8859-1
> Anton> set target-wide-charset ISO-8859-1
>
> This is almost certainly wrong. You probably want `set
> target-wide-charset UTF-32' -- which is the default on Linux. At least,
> that will be what you want if your code is using wchar_t.
>
> Also, I recommend against using "set charset"; use target-charset
> instead. 'set charset' sets the host charset in addition to the target
> charset, but on systems with a decent locale implementation, you
> basically will always want to use the result reported by the locale.
>
> Anton> sys.path.insert(0, '/home/anton/projects/debug/printers')
>
> Without the source to this we can't be completely sure about the
> problem.
>
> Anton> Within my debug session I use the following commonds on gdb console:
>
> Anton> set print sevenbit-strings off
> Anton> print qsHtml
> Anton> $4 = "h\366h\366h\366"
>
> What type is a qsHtml? Specifically, what is the underlying character
> type it uses?
>
> Tom
>
>
>
next prev parent reply other threads:[~2010-03-05 8:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-04 11:57 Anton Kunze
2010-03-04 18:09 ` Tom Tromey
2010-03-04 21:25 ` Anton Kunze
2010-03-05 8:33 ` Anton Kunze [this message]
2010-03-05 15:41 ` Tom Tromey
2010-03-08 9:00 ` Anton Kunze
2010-03-08 18:03 ` Tom Tromey
2010-03-09 7:49 ` Anton Kunze
2010-03-08 19:41 ` Tom Tromey
2010-03-09 7:54 ` Anton Kunze
2010-03-09 19:56 ` Niko Sams
2010-03-09 10:29 ` André Pönitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4B90C17B.8020001@technosis.de \
--to=ak@technosis.de \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox