From: Eli Zaretskii <eliz@gnu.org>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org, tromey@redhat.com
Subject: Re: printing 0xbeef wchar_t on x86-windows...
Date: Mon, 15 Oct 2012 19:46:00 -0000 [thread overview]
Message-ID: <83hapv4iy4.fsf@gnu.org> (raw)
In-Reply-To: <20121015190052.GH3034@adacore.com>
> Date: Mon, 15 Oct 2012 12:00:52 -0700
> From: Joel Brobecker <brobecker@adacore.com>
> Cc: Tom Tromey <tromey@redhat.com>
>
> wchar_t single = 0xbeef;
>
> But with the current HEAD, I get:
>
> (gdb) print single
> $5 = 48879 L'\357'
>
> In chronological order:
>
> * valprint.c:generic_emit_char calls wchar_iterate, and finds
> one valid character according to the intermediate encoding
> ("wchar_t"), even though the character isn't valid in the
> original/target charset ("CP1252").
How would cp1252 enter the picture, when you are talking about a
wchar_t data type?
> But unfortunately for us, Window's iswprint likes 0xbeef as
> printable
This happens to be a Unicode codepoint of a Hangul word-constituent
character. That's what you get for putting random values into wchar_t
data type ;-)
> But the problem is that convert_between_encodings was called
> with the width set to 1, instead of using the character type's
> size.
>
> With the attached patch, we now get the following output...
>
> (gdb) print single
> $2 = 48879 L'\357\276'
>
> ... which is no longer missing half of the wide character value.
I guess that's the right output, so long as your output charset does
not support that Hangul character.
next prev parent reply other threads:[~2012-10-15 19:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-15 19:01 Joel Brobecker
2012-10-15 19:46 ` Eli Zaretskii [this message]
2012-10-15 20:14 ` Joel Brobecker
2012-10-16 20:43 ` Tom Tromey
2012-10-16 22:43 ` Joel Brobecker
2012-10-17 1:37 ` Tom Tromey
2012-10-17 14:58 ` Joel Brobecker
2012-10-17 18:28 ` Tom Tromey
2012-10-17 18:43 ` Joel Brobecker
2012-10-17 19:20 ` Tom Tromey
2012-10-16 23:31 ` Joel Brobecker
2012-10-17 1:38 ` Tom Tromey
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=83hapv4iy4.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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