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]

[RFC 1/6] Fix display of tabulation character for mingw hosts.


  Tabulation characters are sent out to stdout as real tabs
inside mingw compiled GDB.
  This is due to the fact that, contrery to other systems,
msvcrt DLL version of iswprint function returns 1
for tab character.
  This patch solves the issue by implementing a mingw-hdep
specific gdb_iswprint version, which returns 0 for tab char.

  Another possiblity would have been to change the implementation
of print_wchar to handle LCST('\t') before calling gdb_isprint.


Pierre Muller
GDB pascal language maintainer




2013-09-26  Pierre Muller  <muller@sourceware.org>

	Fix display of tabulation character for mingw hosts.
 	* gdb_wchar.h (gdb_iswprint): Declare as external function
 	if __MINGW32__ macro is set.
	* mingw-hdep.c (gdb_iswprint): New function.


>From a06acf167fde7fb8502028f83cdfaf64fc2c307b Mon Sep 17 00:00:00 2001
From: Pierre Muller <muller@ics.u-strasbg.fr>
Date: Thu, 26 Sep 2013 16:20:38 +0200
---
 gdb/gdb_wchar.h  |    4 ++++
 gdb/mingw-hdep.c |    9 +++++++++
 2 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/gdb/gdb_wchar.h b/gdb/gdb_wchar.h
index 0e785e8..2d85b5e 100644
--- a/gdb/gdb_wchar.h
+++ b/gdb/gdb_wchar.h
@@ -65,7 +65,11 @@ typedef wchar_t gdb_wchar_t;
 typedef wint_t gdb_wint_t;
 
 #define gdb_wcslen wcslen
+#ifdef __MINGW32__
+extern int gdb_iswprint (gdb_wint_t);
+#else
 #define gdb_iswprint iswprint
+#endif
 #define gdb_iswdigit iswdigit
 #define gdb_btowc btowc
 #define gdb_WEOF WEOF
diff --git a/gdb/mingw-hdep.c b/gdb/mingw-hdep.c
index efc9848..976e9e8 100644
--- a/gdb/mingw-hdep.c
+++ b/gdb/mingw-hdep.c
@@ -80,6 +80,15 @@ safe_strerror (int errnum)
 
   return buffer;
 }
+/* Mingw specific version of iswprint to correct
+   difference concerning the tabulation character:
+   msvcrt dll iswprint returns 1 for '\t' while
+   UNIX uiswprint function returns 0 for '\t'.  */
+
+int gdb_iswprint (gdb_wint_t wc)
+{
+  return wc == LCST ('\t') ? 0 : iswprint (wc);
+}
 
 /* Return an absolute file name of the running GDB, if possible, or
    ARGV0 if not.  The return value is in malloc'ed storage.  */
-- 
1.7.9


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