[2/5] gdb: make use of set_tdesc_osabi overload in features/ files

Message ID 92ff2aaf4d9804491ca5c31849ff51025f2b6186.1728407374.git.aburgess@redhat.com
State New
Headers
Series Set osabi in remote target descriptions |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed

Commit Message

Andrew Burgess Oct. 8, 2024, 5:11 p.m. UTC
  There are two versions of the set_tdesc_osabi function in GDB:

  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;
  }

In the gdb/features/ files we call the second of these functions, like
this:

  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux"));

This can be replaced with a call to the first set_tdesc_osabi
function, so lets do that.  I think that this makes the features/ code
slightly simpler and easier to understand.

There should be no user visible changes after this commit.

Approved-By: Tom Tromey <tom@tromey.com>
---
 gdb/features/mips-dsp-linux.c        | 2 +-
 gdb/features/mips-linux.c            | 2 +-
 gdb/features/or1k-linux.c            | 2 +-
 gdb/features/sparc/sparc32-solaris.c | 2 +-
 gdb/features/sparc/sparc64-solaris.c | 2 +-
 gdb/target-descriptions.c            | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)
  

Patch

diff --git a/gdb/features/mips-dsp-linux.c b/gdb/features/mips-dsp-linux.c
index d8e40283caf..17d30aac68f 100644
--- a/gdb/features/mips-dsp-linux.c
+++ b/gdb/features/mips-dsp-linux.c
@@ -11,7 +11,7 @@  initialize_tdesc_mips_dsp_linux (void)
   target_desc_up result = allocate_target_description ();
   set_tdesc_architecture (result.get (), bfd_scan_arch ("mips"));
 
-  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux"));
+  set_tdesc_osabi (result.get (), "GNU/Linux");
 
   struct tdesc_feature *feature;
 
diff --git a/gdb/features/mips-linux.c b/gdb/features/mips-linux.c
index f93eef5e41d..a43526db24e 100644
--- a/gdb/features/mips-linux.c
+++ b/gdb/features/mips-linux.c
@@ -11,7 +11,7 @@  initialize_tdesc_mips_linux (void)
   target_desc_up result = allocate_target_description ();
   set_tdesc_architecture (result.get (), bfd_scan_arch ("mips"));
 
-  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux"));
+  set_tdesc_osabi (result.get (), "GNU/Linux");
 
   struct tdesc_feature *feature;
 
diff --git a/gdb/features/or1k-linux.c b/gdb/features/or1k-linux.c
index 24731458de2..551b38f59c0 100644
--- a/gdb/features/or1k-linux.c
+++ b/gdb/features/or1k-linux.c
@@ -11,7 +11,7 @@  initialize_tdesc_or1k_linux (void)
   target_desc_up result = allocate_target_description ();
   set_tdesc_architecture (result.get (), bfd_scan_arch ("or1k"));
 
-  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("GNU/Linux"));
+  set_tdesc_osabi (result.get (), "GNU/Linux");
 
   struct tdesc_feature *feature;
 
diff --git a/gdb/features/sparc/sparc32-solaris.c b/gdb/features/sparc/sparc32-solaris.c
index dce96851f96..ce57abaaaf2 100644
--- a/gdb/features/sparc/sparc32-solaris.c
+++ b/gdb/features/sparc/sparc32-solaris.c
@@ -11,7 +11,7 @@  initialize_tdesc_sparc32_solaris (void)
   target_desc_up result = allocate_target_description ();
   set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc"));
 
-  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris"));
+  set_tdesc_osabi (result.get (), "Solaris");
 
   struct tdesc_feature *feature;
 
diff --git a/gdb/features/sparc/sparc64-solaris.c b/gdb/features/sparc/sparc64-solaris.c
index d030df63c6c..92cc88cd5cf 100644
--- a/gdb/features/sparc/sparc64-solaris.c
+++ b/gdb/features/sparc/sparc64-solaris.c
@@ -11,7 +11,7 @@  initialize_tdesc_sparc64_solaris (void)
   target_desc_up result = allocate_target_description ();
   set_tdesc_architecture (result.get (), bfd_scan_arch ("sparc:v9"));
 
-  set_tdesc_osabi (result.get (), osabi_from_tdesc_string ("Solaris"));
+  set_tdesc_osabi (result.get (), "Solaris");
 
   struct tdesc_feature *feature;
 
diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index d78da14918f..c165750c6c5 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1318,7 +1318,7 @@  class print_c_tdesc : public tdesc_element_visitor
 	&& tdesc_osabi (e) < GDB_OSABI_INVALID)
       {
 	gdb_printf
-	  ("  set_tdesc_osabi (result.get (), osabi_from_tdesc_string (\"%s\"));\n",
+	  ("  set_tdesc_osabi (result.get (), \"%s\");\n",
 	   gdbarch_osabi_name (tdesc_osabi (e)));
 	gdb_printf ("\n");
       }