[RFA] defs.h: Define GDB_DEFAULT_TARGET_[WIDE_]CHARSET for Cygwin and MingW builds

Corinna Vinschen vinschen@redhat.com
Sun Feb 28 15:03:00 GMT 2010


On Feb 28 09:29, Daniel Jacobowitz wrote:
> On Sun, Feb 28, 2010 at 02:05:00PM +0100, Corinna Vinschen wrote:
> > 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?
> 
> No, this isn't right.  __CYGWIN__ and _WIN32 are host checks, and
> these charsets are target properties.  So this will not have the
> desired effect.
> 
> Hmm, does this mean these macros should become gdbarch properties?
> That could be awkward in practice.

I don't know because I don't know the affected code good enough,
but as it is now, the code doesn't work on Cygwin, and probably
on no UTF-16 target.

If the codeset is target-specific anyway, then the idea of the
GDB_DEFAULT_TARGET_WIDE_CHARSET and GDB_DEFAULT_TARGET_CHARSET variables
is either wrong, or it must be possible to define them somewhere
on a per-target base.  What about windows-tdep.h?


Corinna

-- 
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat



More information about the Gdb-patches mailing list