Re: PATCH: Enable x86 XML target descriptions

Mark Kettenis
2010-02-17T16:19:47Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

> Date: Wed, 17 Feb 2010 10:45:54 -0500
> From: Daniel Jacobowitz <dan@codesourcery.com>
>
> On Wed, Feb 17, 2010 at 07:41:48AM -0800, H.J. Lu wrote:
> > > Also, you should split i386_linux_register_name(),
> > > i386_linix_register_type() i386_linux_init_orig_eax() into seperate
> > > i386 and amd64 versions, and get rid of all the #ifdef BFD64's in the
> > > *-tdep.c files.  There has been a clear split between 32-bit and
> > > 64-bit versions of the *-tdep.c code and this diff blurrs that.
> >
> > I am not sure it is easy to do, especially for register description.
> > I have an impression that tdesc_use_registers should only be called
> > once per arch. i386 and amd64 belong to the same bfd_arch_i386.
>
> So? You can still call set_gdbarch_register_name.
>
> > I can try to minimize BFD64. But I am afraid that I can't totally avoid it.
> > Is that acceptable?
>
> No, amd64 support really should be in its own file.

So I guess a potential way of handling this, is to leave the
set_gdbarch_num_regs/set_gdbarch_register_name/set_gdbarch_register_type
calls as they are now, add a tdesc member to "struct gdbarch_tdep",
initialize that in the xxx_init_abi() functions (if a target
description is available), possibly overriding a less-specific
setting, and call tdesc_use_registers at the very end of
i386_gdbarch_init() if the tdesc member of "struct gdbarch_tdep" is
non-NULL.