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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
arm Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
i386 gdb, gdbserver, python, testsuite: Remove MPX. 2024-09-25 11:06:57 +00:00
loongarch gdb: LoongArch: Add LBT extension support 2024-02-06 18:40:19 +08:00
riscv Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
rs6000 gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
sparc gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi 2024-10-10 17:36:21 +01:00
aarch64-core.c
aarch64-core.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-fpu.c [AArch64] Update FPSR/FPCR fields for FPU and SVE 2022-10-04 09:14:34 +01:00
aarch64-fpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-mte.c
aarch64-mte.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-pauth.c
aarch64-pauth.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-sme2.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-sme.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-sve.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
aarch64-tls.c Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
btrace-conf.dtd btrace: Enable event tracing on Linux for Intel PT. 2024-09-24 14:22:28 +02:00
btrace.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
cskyv2-linux.c
cskyv2-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
feature_to_c.awk [gdb/build] Add GPL header comment to gdb/features/feature_to_c.awk 2024-06-18 17:26:22 +02:00
feature_to_c.sh [gdb/build] Cleanup gdb/features/feature_to_c.sh 2024-06-15 08:10:44 +02:00
gdb-target.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
gdbserver-regs.xsl
library-list-aix.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
library-list-svr4.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
library-list.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
m68k-core.xml
Makefile gdb/regformats: add osabi information to generated .dat files 2024-11-12 12:51:36 +00:00
microblaze-core.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
microblaze-stack-protect.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
microblaze-with-stack-protect.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
microblaze-with-stack-protect.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
microblaze.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
microblaze.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips64-cp0.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips64-cpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips64-fpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips-cpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips-dsp-linux.c gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi 2024-10-10 17:36:21 +01:00
mips-dsp-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips-dsp.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips-fpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
mips-linux.c gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi 2024-10-10 17:36:21 +01:00
mips-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nds32-core.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nds32-fpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nds32-system.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nds32.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
nds32.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nios2-cpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nios2-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
nios2.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
nios2.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
number-regs.xsl
or1k-core.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
or1k-linux.c gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi 2024-10-10 17:36:21 +01:00
or1k-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
or1k.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
or1k.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
osdata.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
print-osabi.xsl gdb/regformats: add osabi information to generated .dat files 2024-11-12 12:51:36 +00:00
rx.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
rx.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390-acr.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390-core32.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390-core64.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390-fpr.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390-gsbc.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
s390x-core64.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
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 Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-c6xp.c
tic6x-c6xp.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-c62x-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-c64x-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-c64xp-linux.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-core.c
tic6x-core.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
tic6x-gp.c
tic6x-gp.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
traceframe-info.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
xinclude.dtd Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
z80-cpu.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00
z80.c gdb, gdbserver, gdbsupport: remove includes of early headers 2024-03-26 21:13:22 -04:00
z80.xml Update copyright year range in header of all files managed by GDB 2024-01-12 15:49:57 +00:00