binutils-gdb/gdb/features
Andrew Burgess 06e9986d02 gdb/regformats: add osabi information to generated .dat files
Some gdbserver targets generate their target description based on the
gdb/regformats/*.dat files.  These .dat files are generated from a
matching xml file in gdb/features/.

Lets consider a concrete example:

Take gdb/features/or1k-linux.xml, this file is processed by
gdb/features/Makefile to create gdb/regformats/or1k-linux.dat.

When gdbserver is built for the or1k target the file
or1k-linux-generated.cc is generated using the
gdb/regformats/regdat.sh script.  This .cc file is then compiled and
linked into gdbserver.

The or1k-linux-generated.cc file contains the function
init_registers_or1k_linux which is called from within gdbserver, this
function creates a target_desc object and sets its xmltarget field to
a fixed string.  This fixed string is the xml filename that was
originally used to generate the xml file, in this case or1k-linux.xml.

Additionally, as part of the gdbserver build the file or1k-linux.xml
is converted to a string and placed in the file
xml-builtin-generated.cc which is then built into gdbserver.

Now when GDB asks gdbserver for the target description, gdbserver
returns the fixed xmltarget string, which is the name of an xml file.
GDB will then ask gdbserver for that file and gdbserver will return
the contents of that file thanks to the xml-builtin-generated.cc
file's contents.

This is all rather complicated, but it does work.  So what's the
problem that I'm fixing?

Well or1k-linux.xml does contain the osabi information, so this will
be returned from gdbserver to GDB.  That's good.

However, the target_desc object created in init_registers_or1k_linux
will not have its osabi set correctly.

Now this doesn't really matter too much except
init_registers_or1k_linux includes a call to init_target_desc.

In the next commit I want to extend init_target_desc to require an
osabi to be passed in.  The motivation for this will be explained in
the next commit, but if we accept for a moment that this is something
that should be done, then the question is what osabi should we use in
init_registers_or1k_linux?

Ideally we'd use the osabi which is set in or1k-linux.xml.  If we do
that then everything will remain consistent, which is a good thing.

And so, to get the osabi from or1k-linux.xml into
init_registers_or1k_linux, we first need to get the osabi information
into or1k-linux.dat file, and this is what this commit does.

I've added a new xsl script print-osabi.xsl and updated
gdb/features/Makefile to make use of this script.  Then I regenerated
all of the .dat files.  Now every .dat file contains either:

  osabi:GNU/Linux
  osabi:unknown

The first is for xml files containing <osabi>GNU/Linux</osabi> and the
second is for xml files that don't contain an osabi element.

This commit doesn't attempt to make use of the osabi information in
the .dat files, that will come in the next commit.  There should be no
user visible changes after this commit.

Approved-By: Kevin Buettner <kevinb@redhat.com>
2024-11-12 12:51:36 +00:00
..
arc
arm
i386
loongarch
riscv
rs6000
sparc
aarch64-core.c
aarch64-core.xml
aarch64-fpu.c
aarch64-fpu.xml
aarch64-mte.c
aarch64-mte.xml
aarch64-pauth.c
aarch64-pauth.xml
aarch64-sme2.c
aarch64-sme.c
aarch64-sve.c
aarch64-tls.c
btrace-conf.dtd
btrace.dtd
cskyv2-linux.c
cskyv2-linux.xml
feature_to_c.awk
feature_to_c.sh
gdb-target.dtd
gdbserver-regs.xsl
library-list-aix.dtd
library-list-svr4.dtd
library-list.dtd
m68k-core.xml
Makefile gdb/regformats: add osabi information to generated .dat files 2024-11-12 12:51:36 +00:00
microblaze-core.xml
microblaze-stack-protect.xml
microblaze-with-stack-protect.c
microblaze-with-stack-protect.xml
microblaze.c
microblaze.xml
mips64-cp0.xml
mips64-cpu.xml
mips64-dsp-linux.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
mips64-dsp-linux.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
mips64-dsp.xml
mips64-fpu.xml
mips64-linux.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
mips64-linux.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
mips-cp0.xml
mips-cpu.xml
mips-dsp-linux.c
mips-dsp-linux.xml
mips-dsp.xml
mips-fpu.xml
mips-linux.c
mips-linux.xml
nds32-core.xml
nds32-fpu.xml
nds32-system.xml
nds32.c
nds32.xml
nios2-cpu.xml
nios2-linux.xml
nios2.c
nios2.xml
number-regs.xsl
or1k-core.xml
or1k-linux.c
or1k-linux.xml
or1k.c
or1k.xml
osdata.dtd
print-osabi.xsl gdb/regformats: add osabi information to generated .dat files 2024-11-12 12:51:36 +00:00
rx.c
rx.xml
s390-acr.xml
s390-core32.xml
s390-core64.xml
s390-fpr.xml
s390-gs-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-gs-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-gs.xml
s390-gsbc.xml
s390-linux32.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux32.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux32v1.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux32v1.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux32v2.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux32v2.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64v1.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64v1.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64v2.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-linux64v2.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-tdb.xml
s390-te-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-te-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-tevx-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-tevx-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-vx-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-vx-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390-vx.xml
s390x-core64.xml
s390x-gs-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-gs-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64v1.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64v1.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64v2.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-linux64v2.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-te-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-te-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-tevx-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-tevx-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-vx-linux64.c gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
s390x-vx-linux64.xml gdb/features: set osabi in all Linux related features/*.xml files 2024-11-12 12:51:36 +00:00
sort-regs.xsl
threads.dtd
tic6x-c6xp.c
tic6x-c6xp.xml
tic6x-c62x-linux.xml
tic6x-c64x-linux.xml
tic6x-c64xp-linux.xml
tic6x-core.c
tic6x-core.xml
tic6x-gp.c
tic6x-gp.xml
traceframe-info.dtd
xinclude.dtd
z80-cpu.xml
z80.c
z80.xml