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

Corinna Vinschen
2010-03-02T10:44:08Z

On Mar 1 16:50, Daniel Jacobowitz wrote:
> On Mon, Mar 01, 2010 at 10:44:43PM +0200, Eli Zaretskii wrote:
> > It sounds like, for cross debugging, the only fair default is ASCII.
> > That way, each user will have to set the right target charset, and no
> > one will feel they are children of a lesser god.
>
> This is a target specific setting. Why is there so much resistance to
> making the target set the property? This is how we handle lots of our
> other global and target-related state.
>
> There's a function, target_wide_charset. It is currently passed a
> byte order, and consults various globals. It should be passed a
> gdbarch instead of a byte order, which will require some refactoring
> but nothing major from my inspection. That's one straightforward
> patch.
>
> target_wide_charset_name can not currently be set to auto. That
> should be allowed, and the default; if it is "auto", then it should
> be returned (and "show target-wide-charset" too) as
> GDB_DEFAULT_TARGET_WIDE_CHARSET. Just like host_charset_name /
> auto_host_charset name. That's another straightforward patch.

This, as well as the same for target_charset_name was already in
my previous patch.

But I don't see a reason to keep the auto_target_wide_charset_name and
auto_target_charset_name variables since they would be entirely replaced
by the gdbarch equivalent...

> Then, GDB_DEFAULT_TARGET_WIDE_CHARSET can become a gdbarch variable.
> The gdbarch created in i386_cygwin_init_abi can set it to the right
> thing. The default can be what it is now. This patch is less
> straightforward because of the existing hacks, like PHONY_ICONV.

The target specifies charset and wide charset. So we need two
target-specific variables. As I mentioned above, both variables would
replace the auto_target...charset variables.

I know how to change gdbarch.sh to add the variables, and I have
all the other stuff almost in place. But I have a problem.

How do I access the current gdbarch from show_target_charset_name,
show_target_wide_charset_name, and all the other functions in charset.c
which refer to the target charsets?

Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat