Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [RFA] defs.h: Define GDB_DEFAULT_TARGET_[WIDE_]CHARSET for Cygwin  and MingW builds
@ 2010-02-28 13:05 Corinna Vinschen
  2010-02-28 14:29 ` Daniel Jacobowitz
  2010-02-28 16:56 ` Eli Zaretskii
  0 siblings, 2 replies; 64+ messages in thread
From: Corinna Vinschen @ 2010-02-28 13:05 UTC (permalink / raw)
  To: gdb-patches

Hi,

today I tested the wide char printing in GDB for the furst time on a
Cygwin build and it didn't work well.  The reson was that the default
for GDB_DEFAULT_TARGET_WIDE_CHARSET is UTF-32, which is bad for a system
defining wchar_t to be UTF-16.  That's Windows for you.

So I applied the below patch, which makes GDB for Cygwin happy.  I also
set the GDB_DEFAULT_TARGET_CHARSET for Cygwin and Win32 to a more sane
default for both systems.


Ok to apply?


Thanks,
Corinna


	* defs.h (GDB_DEFAULT_TARGET_WIDE_CHARSET): Define as UTF-16 for
	Windows-based systems.
	(GDB_DEFAULT_TARGET_CHARSET): Set to UTF-8 for Cygwin and CP1252
	for other Windows-based systems.


Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.265
diff -u -p -r1.265 defs.h
--- defs.h	25 Feb 2010 20:30:58 -0000	1.265
+++ defs.h	28 Feb 2010 13:04:26 -0000
@@ -1192,6 +1192,22 @@ extern int use_windows;
 #define ISATTY(FP)	(isatty (fileno (FP)))
 #endif
 
+/* The default wide character charset is UTF-32, which is wrong for
+   Windows-based systems which use UTF-16. */
+#if defined (__CYGWIN__) || defined (_WIN32)
+#define GDB_DEFAULT_TARGET_WIDE_CHARSET "UTF-16"
+#endif
+
+/* The default output charset for Cygwin is UTF-8.  The default output
+   charset for Win32 is the default ANSI codepage of the system, which
+   depends on the localization of the underlying Windows system.  However,
+   CP1252 is a good default replacement for ISO-8859-1 at least. */
+#if defined (__CYGWIN__)
+#define GDB_DEFAULT_TARGET_CHARSET "UTF-8"
+#elif defined (_WIN32)
+#define GDB_DEFAULT_TARGET_CHARSET "CP1252"
+#endif
+
 /* Ensure that V is aligned to an N byte boundary (B's assumed to be a
    power of 2).  Round up/down when necessary.  Examples of correct
    use include:


-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat


^ permalink raw reply	[flat|nested] 64+ messages in thread

end of thread, other threads:[~2010-03-05  8:55 UTC | newest]

Thread overview: 64+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-28 13:05 [RFA] defs.h: Define GDB_DEFAULT_TARGET_[WIDE_]CHARSET for Cygwin and MingW builds Corinna Vinschen
2010-02-28 14:29 ` Daniel Jacobowitz
2010-02-28 15:03   ` Corinna Vinschen
2010-02-28 18:48     ` Daniel Jacobowitz
2010-02-28 19:22       ` Corinna Vinschen
2010-02-28 22:27         ` Daniel Jacobowitz
2010-03-01 10:31           ` Corinna Vinschen
2010-03-01 17:11             ` Eli Zaretskii
2010-03-01 17:28               ` Corinna Vinschen
2010-03-01 17:21             ` Tom Tromey
2010-03-01 17:23               ` Daniel Jacobowitz
2010-03-01 17:27                 ` Corinna Vinschen
2010-03-01 17:31               ` Corinna Vinschen
2010-03-01 19:25                 ` Tom Tromey
2010-03-01 19:31                   ` Daniel Jacobowitz
2010-03-01 20:06                     ` Corinna Vinschen
2010-03-01 20:44                     ` Eli Zaretskii
2010-03-01 21:50                       ` Daniel Jacobowitz
2010-03-02 10:44                         ` Corinna Vinschen
2010-03-02 13:54                           ` Daniel Jacobowitz
2010-03-02 14:13                             ` Corinna Vinschen
2010-03-02 15:03                               ` Daniel Jacobowitz
2010-03-02 17:43                                 ` Corinna Vinschen
2010-03-02 17:59                     ` Tom Tromey
2010-03-02 18:22                       ` Corinna Vinschen
2010-03-02 18:28                         ` Corinna Vinschen
2010-03-02 22:55                       ` Tom Tromey
2010-03-02 22:57                         ` Tom Tromey
2010-03-03 10:16                           ` Corinna Vinschen
2010-03-03 10:41                             ` Corinna Vinschen
2010-03-03 10:59                               ` Corinna Vinschen
2010-03-03 16:26                                 ` Tom Tromey
2010-03-03 10:16                         ` Corinna Vinschen
2010-03-03 16:25                           ` Tom Tromey
2010-03-03 16:46                             ` Corinna Vinschen
2010-03-05  8:55                               ` Charles Wilson
2010-03-03 21:15                           ` Tom Tromey
2010-03-04  9:34                             ` Corinna Vinschen
2010-03-04 15:24                               ` Christopher Faylor
2010-03-04 15:38                                 ` Corinna Vinschen
2010-03-03 17:08                         ` Daniel Jacobowitz
2010-03-03 17:22                           ` Corinna Vinschen
2010-03-03 17:27                             ` Corinna Vinschen
2010-03-03 17:33                             ` Daniel Jacobowitz
2010-03-03 17:42                               ` Eli Zaretskii
2010-03-03 18:00                               ` Corinna Vinschen
2010-03-03 18:05                                 ` Daniel Jacobowitz
2010-03-03 18:22                                   ` Corinna Vinschen
2010-03-03 19:39                                     ` Daniel Jacobowitz
2010-03-03 20:16                                       ` Eli Zaretskii
2010-03-03 20:26                                         ` Daniel Jacobowitz
2010-03-03 21:08                           ` Tom Tromey
2010-03-01 17:12           ` Tom Tromey
2010-03-01 17:21             ` Daniel Jacobowitz
2010-03-01 17:28               ` Tom Tromey
2010-03-01 17:50                 ` Corinna Vinschen
2010-02-28 16:56 ` Eli Zaretskii
2010-02-28 17:05   ` Corinna Vinschen
2010-02-28 17:45     ` Eli Zaretskii
2010-02-28 17:52       ` Corinna Vinschen
2010-02-28 18:11         ` Corinna Vinschen
2010-02-28 18:59           ` Eli Zaretskii
2010-02-28 19:23             ` Corinna Vinschen
2010-02-28 18:59         ` Eli Zaretskii

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox