This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] PR exp/9103


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,

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]