aboutsummaryrefslogtreecommitdiff
path: root/gdb/osabi.c
diff options
context:
space:
mode:
authorTom de Vries <tdevries@suse.de>2022-06-03 15:34:50 +0200
committerTom de Vries <tdevries@suse.de>2022-06-03 15:34:50 +0200
commit0e02119e65b566cad575cc57fe423dadab855a56 (patch)
tree2e87adc976564f94062e7d8eec9d70483e44e4cc /gdb/osabi.c
parenta98600052eb680249abae0083a7c24d7e57f7379 (diff)
downloadbinutils-0e02119e65b566cad575cc57fe423dadab855a56.zip
binutils-0e02119e65b566cad575cc57fe423dadab855a56.tar.gz
binutils-0e02119e65b566cad575cc57fe423dadab855a56.tar.bz2
Revert "[gdb] Fix warning in foreach_arch selftests"
This reverts commit fc18b1c5afd ("[gdb] Fix warning in foreach_arch selftests"). The commit introduced regressions for an --enable-targets=all build: ... Running selftest print_one_insn::A6.^M Self test failed: Cannot access memory at address 0x0^M ... and while investigating those I realized that the commit fc18b1c5afd complicates things by trying to set the current osabi. So, revert the patch in preparation for a simpler solution. Tested on x86_64-linux.
Diffstat (limited to 'gdb/osabi.c')
-rw-r--r--gdb/osabi.c50
1 files changed, 12 insertions, 38 deletions
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 776e620..bbd7635 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -32,7 +32,7 @@
#endif
/* State for the "set osabi" command. */
-static enum gdb_osabi_mode user_osabi_state;
+static enum { osabi_auto, osabi_default, osabi_user } user_osabi_state;
static enum gdb_osabi user_selected_osabi;
static const char *gdb_osabi_available_names[GDB_OSABI_INVALID + 3] = {
"auto",
@@ -595,48 +595,15 @@ generic_elf_osabi_sniffer (bfd *abfd)
return osabi;
}
-/* See osabi.h. */
-
-void
-set_osabi (enum gdb_osabi_mode mode, enum gdb_osabi osabi)
-{
- if (mode == osabi_auto)
- user_osabi_state = osabi_auto;
- else if (mode == osabi_default)
- {
- user_selected_osabi = GDB_OSABI_DEFAULT;
- user_osabi_state = osabi_user;
- }
- else
- {
- user_selected_osabi = osabi;
- user_osabi_state = osabi_user;
- }
-
- /* NOTE: At some point (true multiple architectures) we'll need to be more
- graceful here. */
- gdbarch_info info;
- if (! gdbarch_update_p (info))
- internal_error (__FILE__, __LINE__, _("Updating OS ABI failed."));
-}
-
-/* See osabi.h. */
-
-void
-get_osabi (enum gdb_osabi_mode &mode, enum gdb_osabi &osabi)
-{
- mode = user_osabi_state;
- osabi = user_selected_osabi;
-}
-
static void
set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
{
if (strcmp (set_osabi_string, "auto") == 0)
- set_osabi (osabi_auto, GDB_OSABI_INVALID);
+ user_osabi_state = osabi_auto;
else if (strcmp (set_osabi_string, "default") == 0)
{
- set_osabi (osabi_default, GDB_OSABI_INVALID);
+ user_selected_osabi = GDB_OSABI_DEFAULT;
+ user_osabi_state = osabi_user;
}
else
{
@@ -648,7 +615,8 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
if (strcmp (set_osabi_string, gdbarch_osabi_name (osabi)) == 0)
{
- set_osabi (osabi_user, osabi);
+ user_selected_osabi = osabi;
+ user_osabi_state = osabi_user;
break;
}
}
@@ -657,6 +625,12 @@ set_osabi (const char *args, int from_tty, struct cmd_list_element *c)
_("Invalid OS ABI \"%s\" passed to command handler."),
set_osabi_string);
}
+
+ /* NOTE: At some point (true multiple architectures) we'll need to be more
+ graceful here. */
+ gdbarch_info info;
+ if (! gdbarch_update_p (info))
+ internal_error (__FILE__, __LINE__, _("Updating OS ABI failed."));
}
static void