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

Corinna Vinschen
2010-03-02T14:13:33Z

On Mar 2 08:54, Daniel Jacobowitz wrote:
> On Tue, Mar 02, 2010 at 11:43:58AM +0100, Corinna Vinschen wrote:
> > 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.
>
> That makes sense.
>
> > 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?
>
> >From the show functions, which are called by the CLI infrastructure, I
> think you're supposed to use get_current_arch (in arch-utils.h).
>
> >From other functions, mostly, you need the caller to pass an
> architecture. An increasing portion of GDB is parameterized
> this way. That'll work for e.g. target_wide_charset ().
>
> I don't think you can do either from _initialize_charset. That may
> have to happen lazily...

It looks to me as if a call to get_current_arch() in target_charset()
is the way to go. Otherwise, I don't see how this can be set up.
The problem here are the various places which call the target_charset()
function. The one call in c-lang.c, function charset_for_string_type()
looks simple, but the calls in util.c and python/py-utils.c look
pretty tricky. Or can I just refer to get_current_arch() in these
places?

Corinna

--
Corinna Vinschen
Cygwin Project Co-Leader
Red Hat