Fix display of tabulation character for mingw hosts.

Message ID 53675BFB.2020702@codesourcery.com
State Committed
Headers

Commit Message

Yao Qi May 5, 2014, 9:38 a.m. UTC
  To make the patch more readable, here is the diff generated with
'git diff -b'.
  

Patch

diff --git a/gdb/valprint.c b/gdb/valprint.c
index fe23530..f55b5db 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1949,18 +1949,10 @@  print_wchar (gdb_wint_t w, const gdb_byte *orig,
   int need_escape = *need_escapep;
 
   *need_escapep = 0;
-  if (gdb_iswprint (w) && (!need_escape || (!gdb_iswdigit (w)
-					    && w != LCST ('8')
-					    && w != LCST ('9'))))
-    {
-      gdb_wchar_t wchar = w;
 
-      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
-	obstack_grow_wstr (output, LCST ("\\"));
-      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
-    }
-  else
-    {
+  /* iswprint implementation on Windows returns 1 for tab character.
+     In order to avoid different printout on this host, we explicitly
+     use wchar_printable function.  */
   switch (w)
     {
       case LCST ('\a'):
@@ -1986,6 +1978,18 @@  print_wchar (gdb_wint_t w, const gdb_byte *orig,
 	break;
       default:
 	{
+	  if (wchar_printable (w) && (!need_escape || (!gdb_iswdigit (w)
+						       && w != LCST ('8')
+						       && w != LCST ('9'))))
+	    {
+	      gdb_wchar_t wchar = w;
+
+	      if (w == gdb_btowc (quoter) || w == LCST ('\\'))
+		obstack_grow_wstr (output, LCST ("\\"));
+	      obstack_grow (output, &wchar, sizeof (gdb_wchar_t));
+	    }
+	  else
+	    {
 	      int i;
 
 	      for (i = 0; i + width <= orig_len; i += width)