This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Enable x86 XML target descriptions


On Sun, Feb 28, 2010 at 12:58:40PM -0800, H.J. Lu wrote:
> > Sorry, but I don't understand this. ?How does checking a register in
> > the target description care about the number of registers set in the
> > gdbarch we're building?
> 
> I copied it from ppc_linux_init_abi. Gdb won't work if I don't reserve
> a register number for orig_rax:

This part of the target descriptions infrastructure was designed to
clean up a confusing aspect of some backends.  If there are well-known
registers - things that GDB has to treat specially for calling
conventions, or read from to determine mode, anything like that - this
lets us give them a fixed register number with a #define.  Then, the
register is concealed at runtime if it is not present on the target.

If you want to have an orig_rax register with a constant register
number, you need to bump up num_regs above that constant.

So the key here is that he's not checking a register in the target.
Independent of the target description supplied, he's bumping up the
total "number of registers" to leave a gap for
AMD64_LINUX_ORIG_RAX_REGNUM, because we said that
AMD64_LINUX_ORIG_RAX_REGNUM was a valid register number
(via the tdesc_numbered_register call).

Is that clearer?

> > Which seems wrong to me. ?Both the core registers and the SSE
> > registers are different in 64-bit mode. ?But perhaps Daniel can shed
> > some light on how these features are supposed to be used?

There are two ways to do this.  For Power, as HJ has pointed out, the
features have size-independent names because they are mostly the same.
There's still an r0, it's just 64-bit instead of 32-bit.
Alternatively, you can define a 32-bit feature and a 64-bit feature
with different names.

IMO it does not make a lot of difference which version you choose.
I would have chosen to give them separate names; there are too many
differences, and I think it would simplify the code.  But given how
amd64 support is treated as an extension of GDB's i386 support,
I can imagine that this approach makes sense.

If we do stick to a single version, the x86 name seems better than
i386.
> The reason is i386_validate_tdesc_p is called by
> i386_gdbarch_init after calling gdbarch_init_osabi,
> which may set up a 64bit target description. If 64bit
> target description has different feature name, it won't
> find core and SSE registers.  If you don't like "i386"
> in the feature name, I can change it to x86.

That's not a reason.  You could just as easily make the code handle
both variants.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]