Re: printing 0xbeef wchar_t on x86-windows...

Tom Tromey
2012-10-17T18:28:37Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> Thanks! I gave it a whirl, JIC, and as you suspected, it does not
Joel> fix the 0xdeadbeef issue on Windows. It looks like a nice improvement,
Joel> however - with maybe one comment which I will send by replying
Joel> to the email...

Thanks.

FWIW the appended builds and regtests ok; but really it needs testing in
your environment.

Tom

diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6e651f6..583329d 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -2037,7 +2037,7 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream,
convert_between_encodings (INTERMEDIATE_ENCODING, host_charset (),
obstack_base (&wchar_buf),
obstack_object_size (&wchar_buf),
- 1, &output, translit_char);
+ sizeof (gdb_wchar_t), &output, translit_char);
obstack_1grow (&output, '\0');

fputs_filtered (obstack_base (&output), stream);
@@ -2278,7 +2278,7 @@ generic_printstr (struct ui_file *stream, struct type *type,
convert_between_encodings (INTERMEDIATE_ENCODING, host_charset (),
obstack_base (&wchar_buf),
obstack_object_size (&wchar_buf),
- 1, &output, translit_char);
+ sizeof (gdb_wchar_t), &output, translit_char);
obstack_1grow (&output, '\0');

fputs_filtered (obstack_base (&output), stream);