This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] PR exp/9103
- From: Andre Oliveira Loureiro do Baixo <andreolb at gmail dot com>
- To: gdb-patches at sourceware dot org
- Date: Wed, 11 Mar 2009 12:25:26 -0300
- Subject: [PATCH] PR exp/9103
- References: <c3f94bcc0903101928g3d767b7ah60ac81e8b6f77de@mail.gmail.com>
There is a bug filled in about GDB not printing (wchar_t *) strings in:
http://sourceware.org/bugzilla/show_bug.cgi?id=9103
This patch solves this bug.
Regards,
André Oliveira Loureiro do Baixo
2009-03-10 Andre Oliveira Loureiro do Baixo <andreolb@gmail.com>
* c-valprint.c (c_val_print): Added support
for printing (wchar_t *) strings.
Index: gdb/gdb/c-valprint.c
===================================================================
--- gdb.orig/gdb/c-valprint.c 2009-03-10 17:08:57.000000000 -0300
+++ gdb/gdb/c-valprint.c 2009-03-10 17:38:09.000000000 -0300
@@ -226,11 +226,12 @@
if (options->addressprint)
fputs_filtered (paddress (addr), stream);
- /* For a pointer to a textual type, also print the string
- pointed to, unless pointer is null. */
- /* FIXME: need to handle wchar_t here... */
+ /* For a pointer to a textual type (including wchar_t),
+ also print the string pointed to, unless pointer is null. */
- if (textual_element_type (elttype, options->format)
+ if ((textual_element_type (elttype, options->format)
+ || (type->main_type->target_type->main_type->name
+ && !(strcmp ((type->main_type->target_type->main_type->name), "wchar_t"))))
&& addr != 0)
{
i = val_print_string (addr, -1, TYPE_LENGTH (elttype), stream,