This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
- From: Keith Seitz <keiths at redhat dot com>
- To: Pierre Muller <pierre dot muller at ics-cnrs dot unistra dot fr>
- Cc: "'gdb-patches'" <gdb-patches at sourceware dot org>
- Date: Tue, 22 Oct 2013 11:24:15 -0700
- Subject: Re: [RFC 1/6 -V2] Fix display of tabulation character for mingw hosts.
- Authentication-results: sourceware.org; auth=none
- References: <002901cebaf2$35ec65a0$a1c530e0$ at muller@ics-cnrs.unistra.fr> <002c01cebaf2$89798ea0$9c6cabe0$ at muller@ics-cnrs.unistra.fr> <524A230B dot 5020304 at redhat dot com> <001501cebe7c$990fba50$cb2f2ef0$ at muller@ics-cnrs.unistra.fr>
On 10/01/2013 01:02 AM, Pierre Muller wrote:
-----Message d'origine-----
De : gdb-patches-owner@sourceware.org [mailto:gdb-patches-
owner@sourceware.org] De la part de Keith Seitz
Envoyé : mardi 1 octobre 2013 03:19
À : Pierre Muller
Cc : 'gdb-patches'
Objet : Re: [RFC 1/6] Fix display of tabulation character for mingw hosts.
Yes, I must confess that I broke more coding style rules
than I usually do here, sorry about that...
It happens to all of us; don't worry about it.
Does this fix the output of many tests in the test suite already? If
not, it would be really, really nice to have a test to check (and
demonstrate) this quirk.
It does fix 2 failures inside printcmds.exp
288-p ctable1[9]
289:$50 = 9 '\t'
290-(gdb) PASS: gdb.base/printcmds.exp: p ctable1[9]
291-p ctable1[10]
292-$51 = 10 '\n'
--
1869-$560 = (unsigned char *) <ctable1+1> "\001\002\003\004\005\006\a\b"...
1870-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1]
1871-p &ctable1[1*8]
1872:$561 = (unsigned char *) <ctable1+8> "\b\t\n\v\f\r\016\017"...
1873-(gdb) PASS: gdb.base/printcmds.exp: p &ctable1[1*8]
1874-p &ctable1[2*8]
1875-$562 = (unsigned char *) <ctable1+16>
"\020\021\022\023\024\025\026\027"...
Is this enough?
Yes, I just wanted to make sure that if this regressed, it would be
caught by some test. I am still having difficulties running tests on MinGW.
Here is a new patch version.
To avoid the very complicated preprocessor checks that decides if we
use wide chars inside gdb_wchar.h, I added a new macro
HAVE_MINGW_GDB_ISWPRINT.
While the idea seems good to me, I am unsure about the choice
of this macro name, are there similar examples already inside the code?
To be honest, I'm not a really big fan of putting platform-specific
knowledge into the source code without abstraction, but in this case,
the alternative of creating, e.g., a nm.h file for this and replicating
all the #if ... logic in gdb_wchar.h is even less appealing to me.
[There is some precedent for this approach, too.]
I would just drop the "MINGW" part of the name. There's always the
possibility that some other platform might require a similar workaround.
Perhaps a maintainer will chime in here with a more
elegant/attractive/appropriate approach.
ChangeLog entry:
2013-10-01 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.
I think you can simply use: "Declare as external function on MinGW."
(HAVE_MINGW_GDB_ISWPRINT): New macro, declared only for
MinGW hosts using wide characters.
* mingw-hdep.c (gdb_iswprint): New function.
Implemented only if HAVE_MINGW_GDB_ISWPRINT macro is defined.
The custom IIRC is to use:
* mingw-hdep.c (gdb_iswprint) [HVAE_MINGW_ISWPRINT]: New function.
I think it is time for a maintainer to review this.
Keith