diff options
author | Andrew Burgess <aburgess@redhat.com> | 2024-10-08 10:34:02 +0100 |
---|---|---|
committer | Andrew Burgess <aburgess@redhat.com> | 2024-10-10 17:36:21 +0100 |
commit | d2f8a107b79a44d64fedc843b9843704dae035a6 (patch) | |
tree | 2d4579695dc35e4ed3dcd826b5f1ba71f506fa33 /gdb/target-descriptions.c | |
parent | 67470b3532fd031959169740fa99550fc8a06b84 (diff) | |
download | gdb-d2f8a107b79a44d64fedc843b9843704dae035a6.zip gdb-d2f8a107b79a44d64fedc843b9843704dae035a6.tar.gz gdb-d2f8a107b79a44d64fedc843b9843704dae035a6.tar.bz2 |
gdb/gdbserver: change shared set_tdesc_osabi to take gdb_osabi
There is a single declaration of set_tdesc_osabi that is shared
between gdbserver/ and gdb/, this declaration takes a 'const char *'
argument which is the string representing an osabi.
Then in gdb/ we have an overload of set_tdesc_osabi which takes an
'enum gdb_osabi'.
In this commit I change the shared set_tdesc_osabi to be the version
which takes an 'enum gdb_osabi', and I remove the version which takes
a 'const char *'. All users of set_tdesc_osabi are updated to pass an
'enum gdb_osabi'.
The features/ code, which is generated from the xml files, requires a
new function to be added to osabi.{c,h} which can return a string
representation of an 'enum gdb_osabi'. With that new function in
place the features/ code is regenerated.
This change is being made to support the next commit. In the next
commit gdbserver will be updated to call set_tdesc_osabi in more
cases. The problem is that gdbserver stores the osabi as a string.
The issue here is that a typo in the gdbserver/ code might go
unnoticed and result in gdbserver sending back an invalid osabi
string.
To fix this we want gdbserver to pass an 'enum gdb_osabi' to the
set_tdesc_osabi function. With that requirement in place it seems to
make sense if all calls to set_tdesc_osabi pass an 'enum gdb_osabi'.
There should be no user visible changes after this commit.
Approved-By: Luis Machado <luis.machado@arm.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/target-descriptions.c')
-rw-r--r-- | gdb/target-descriptions.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index c165750..1bd22c2 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -1200,12 +1200,6 @@ set_tdesc_architecture (struct target_desc *target_desc, /* See gdbsupport/tdesc.h. */ void -set_tdesc_osabi (struct target_desc *target_desc, const char *name) -{ - set_tdesc_osabi (target_desc, osabi_from_tdesc_string (name)); -} - -void set_tdesc_osabi (struct target_desc *target_desc, enum gdb_osabi osabi) { target_desc->osabi = osabi; @@ -1317,9 +1311,8 @@ public: if (tdesc_osabi (e) > GDB_OSABI_UNKNOWN && tdesc_osabi (e) < GDB_OSABI_INVALID) { - gdb_printf - (" set_tdesc_osabi (result.get (), \"%s\");\n", - gdbarch_osabi_name (tdesc_osabi (e))); + const char *enum_name = gdbarch_osabi_enum_name (tdesc_osabi (e)); + gdb_printf (" set_tdesc_osabi (result.get (), %s);\n", enum_name); gdb_printf ("\n"); } |