diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-01-30 15:37:23 +0000 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-03-25 17:14:19 +0000 |
commit | 198ff6ff819c240545f9fc68b39636fd376d4ba9 (patch) | |
tree | 9d5f4bd1ef2e3dc80d9035ecc7402ee0c5e1e6e2 /gdbserver/Makefile.in | |
parent | 61bb321605fc74703adc994fd7a78e9d2495ca7a (diff) | |
download | gdb-198ff6ff819c240545f9fc68b39636fd376d4ba9.zip gdb-198ff6ff819c240545f9fc68b39636fd376d4ba9.tar.gz gdb-198ff6ff819c240545f9fc68b39636fd376d4ba9.tar.bz2 |
gdb/gdbserver: share x86/linux tdesc caching
This commit builds on the previous series of commits to share the
target description caching code between GDB and gdbserver for
x86/Linux targets.
The objective of this commit is to move the four functions (2 each of)
i386_linux_read_description and amd64_linux_read_description into
gdb/nat/x86-linux-tdesc.c and combine them so we have just a single
copy of each. Then both GDB and gdbserver will link against these
shared functions.
It is worth reading the description of the previous commit to see why
this merging is not as simple as it seems: on the gdbserver side we
actually have two users of these functions, gdbserver itself, and the
in process agent (IPA).
However, the previous commit streamlined the gdbserver code, and so
now it is simple to move the two functions along with all their
support functions from the gdbserver directory into the gdb/nat/
directory, and then GDB is fine to call these functions.
One small curiosity with this patch is the function
x86_linux_post_init_tdesc. On the gdbserver side the two functions
amd64_linux_read_description and i386_linux_read_description have some
functionality that is not present on the GDB side, that is some
additional configuration that is performed as each target description
is created to setup the expedited registers.
To support this I've added the function x86_linux_post_init_tdesc.
This function is called from the two *_linux_read_description
functions, but is implemented separately for GDB and gdbserver.
This does mean adding back some non-shared code when this whole series
has been about sharing code, but now the only non-shared bit is the
single line that is actually different between GDB and gdbserver, all
the rest, which is identical, is now shared.
I did need to add a new rule to the gdbserver Makefile, this is to
allow the nat/x86-linux-tdesc.c file to be compiled for the IPA.
Approved-By: John Baldwin <jhb@FreeBSD.org>
Diffstat (limited to 'gdbserver/Makefile.in')
-rw-r--r-- | gdbserver/Makefile.in | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gdbserver/Makefile.in b/gdbserver/Makefile.in index c712089..bd6f68e 100644 --- a/gdbserver/Makefile.in +++ b/gdbserver/Makefile.in @@ -519,6 +519,10 @@ gdbsupport/%-ipa.o: ../gdbsupport/%.cc $(IPAGENT_COMPILE) $< $(POSTCOMPILE) +nat/%-ipa.o: ../gdb/nat/%.c + $(IPAGENT_COMPILE) $< + $(POSTCOMPILE) + %-ipa.o: ../gdb/%.c $(IPAGENT_COMPILE) -x c++ $< $(POSTCOMPILE) |