binutils-gdb/gdb/features/rs6000
Andrew Burgess 9a103324fe gdb: check for duplicate register names in selftest
Building on the previous commit, this commit extends the register_name
selftest to check for duplicate register names.

If two registers in the cooked register set (real + pseudo registers)
have the same name, then this will show up as duplicate registers in
the 'info all-registers' output, but the user will only be able to
interact with one copy of the register.

In this commit I extend the selftest that I added in the previous
commit to check for duplicate register names, I didn't include this
functionality in the previous commit because one architecture needed
fixing, and I wanted to keep those fixes separate from the fixes in
the previous commit.

The problematic architecture(s) are powerpc:750 and powerpc:604.  In
both of these cases the 'dabr' register appears twice, there's a
definition of dabr in power-oea.xml which is included into both
powerpc-604.xml and powerpc-750.xml.  Both of these later two xml
files also define the dabr register.

I'm hopeful that this change shouldn't break anything, but I don't
have the ability to actually test this change, however:

On the gdbserver side, neither powerpc-604.xml nor powerpc-750.xml are
mentioned in gdbserver/configure.srv, which I think means that
gdbserver will never use these descriptions, and,

Within GDB the problematic descriptions are held in the variables
tdesc_powerpc_604 and tdesc_powerpc_750, which are only mentioned in
the variants array in rs6000-tdep.c, this is used when looking up a
description based on the architecture.

For a native Linux target however, this will not be used as
ppc_linux_nat_target::read_description exists, which calls
ppc_linux_match_description, which I don't believe can return either
of the problematic descriptions.

This leaves the other native targets, FreeBSD, AIX, etc.  These don't
appear to override the ::read_description method, so will potentially
return the problematic descriptions, but, in each case I think the
::fetch_registers and ::store_registers methods will ignore the dabr
register, which will leave the register as <unavailable>.

So, my proposed solution is to just remove the duplicate register from
each of powerpc-604.xml and powerpc-750.xml, then regenerate the
corresponding C++ source file.  With this change made, the selftest
now passes for all architectures.
2022-10-02 14:21:24 +01:00
..
power64-core.xml
power64-htm-core.xml
power64-linux.xml
power-altivec.xml
power-core.xml
power-dscr.xml
power-ebb.xml
power-fpu-isa205.xml
power-fpu.xml
power-htm-altivec.xml
power-htm-core.xml
power-htm-dscr.xml
power-htm-fpu.xml
power-htm-ppr.xml
power-htm-spr.xml
power-htm-tar.xml
power-htm-vsx.xml
power-linux-pmu.xml
power-linux.xml
power-oea.xml
power-ppr.xml
power-spe.xml
power-tar.xml
power-vsx.xml
powerpc-32.c
powerpc-32.xml
powerpc-32l.c
powerpc-32l.xml
powerpc-64.c
powerpc-64.xml
powerpc-64l.c
powerpc-64l.xml
powerpc-403.c
powerpc-403.xml
powerpc-403gc.c
powerpc-403gc.xml
powerpc-405.c
powerpc-405.xml
powerpc-505.c
powerpc-505.xml
powerpc-601.c
powerpc-601.xml
powerpc-602.c
powerpc-602.xml
powerpc-603.c
powerpc-603.xml
powerpc-604.c
powerpc-604.xml
powerpc-750.c
powerpc-750.xml
powerpc-860.c
powerpc-860.xml
powerpc-7400.c
powerpc-7400.xml
powerpc-altivec32.c
powerpc-altivec32.xml
powerpc-altivec32l.c
powerpc-altivec32l.xml
powerpc-altivec64.c
powerpc-altivec64.xml
powerpc-altivec64l.c
powerpc-altivec64l.xml
powerpc-e500.c
powerpc-e500.xml
powerpc-e500l.c
powerpc-e500l.xml
powerpc-isa205-32l.c
powerpc-isa205-32l.xml
powerpc-isa205-64l.c
powerpc-isa205-64l.xml
powerpc-isa205-altivec32l.c
powerpc-isa205-altivec32l.xml
powerpc-isa205-altivec64l.c
powerpc-isa205-altivec64l.xml
powerpc-isa205-ppr-dscr-vsx32l.c
powerpc-isa205-ppr-dscr-vsx32l.xml
powerpc-isa205-ppr-dscr-vsx64l.c
powerpc-isa205-ppr-dscr-vsx64l.xml
powerpc-isa205-vsx32l.c
powerpc-isa205-vsx32l.xml
powerpc-isa205-vsx64l.c
powerpc-isa205-vsx64l.xml
powerpc-isa207-htm-vsx32l.c
powerpc-isa207-htm-vsx32l.xml
powerpc-isa207-htm-vsx64l.c
powerpc-isa207-htm-vsx64l.xml
powerpc-isa207-vsx32l.c
powerpc-isa207-vsx32l.xml
powerpc-isa207-vsx64l.c
powerpc-isa207-vsx64l.xml
powerpc-vsx32.c
powerpc-vsx32.xml
powerpc-vsx32l.c
powerpc-vsx32l.xml
powerpc-vsx64.c
powerpc-vsx64.xml
powerpc-vsx64l.c
powerpc-vsx64l.xml
rs6000.c
rs6000.xml