/* Dynamic architecture support for GDB, the GNU debugger.
- Copyright (C) 1998-2021 Free Software Foundation, Inc.
+ Copyright (C) 1998-2022 Free Software Foundation, Inc.
This file is part of GDB.
endian_auto,
NULL,
};
-static const char *set_endian_string;
+static const char *set_endian_string = endian_auto;
enum bfd_endian
selected_byte_order (void)
{
if (target_byte_order_user == BFD_ENDIAN_UNKNOWN)
if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG)
- fprintf_unfiltered (file, _("The target endianness is set automatically "
- "(currently big endian).\n"));
+ gdb_printf (file, _("The target endianness is set automatically "
+ "(currently big endian).\n"));
else
- fprintf_unfiltered (file, _("The target endianness is set automatically "
- "(currently little endian).\n"));
+ gdb_printf (file, _("The target endianness is set automatically "
+ "(currently little endian).\n"));
else
if (target_byte_order_user == BFD_ENDIAN_BIG)
- fprintf_unfiltered (file,
- _("The target is set to big endian.\n"));
+ gdb_printf (file,
+ _("The target is set to big endian.\n"));
else
- fprintf_unfiltered (file,
- _("The target is set to little endian.\n"));
+ gdb_printf (file,
+ _("The target is set to little endian.\n"));
}
static void
{
info.byte_order = BFD_ENDIAN_LITTLE;
if (! gdbarch_update_p (info))
- printf_unfiltered (_("Little endian target not supported by GDB\n"));
+ gdb_printf (gdb_stderr,
+ _("Little endian target not supported by GDB\n"));
else
target_byte_order_user = BFD_ENDIAN_LITTLE;
}
{
info.byte_order = BFD_ENDIAN_BIG;
if (! gdbarch_update_p (info))
- printf_unfiltered (_("Big endian target not supported by GDB\n"));
+ gdb_printf (gdb_stderr,
+ _("Big endian target not supported by GDB\n"));
else
target_byte_order_user = BFD_ENDIAN_BIG;
}
struct cmd_list_element *c, const char *value)
{
if (target_architecture_user == NULL)
- fprintf_filtered (file, _("The target architecture is set to "
- "\"auto\" (currently \"%s\").\n"),
- gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
+ gdb_printf (file, _("The target architecture is set to "
+ "\"auto\" (currently \"%s\").\n"),
+ gdbarch_bfd_arch_info (get_current_arch ())->printable_name);
else
- fprintf_filtered (file, _("The target architecture is set to \"%s\".\n"),
- set_architecture_string);
+ gdb_printf (file, _("The target architecture is set to \"%s\".\n"),
+ set_architecture_string);
}
if (gdbarch_update_p (info))
target_architecture_user = info.bfd_arch_info;
else
- printf_unfiltered (_("Architecture `%s' not recognized.\n"),
- set_architecture_string);
+ gdb_printf (gdb_stderr,
+ _("Architecture `%s' not recognized.\n"),
+ set_architecture_string);
}
show_architecture (gdb_stdout, from_tty, NULL, NULL);
}
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
- "Architecture not found\n");
+ gdb_printf (gdb_stdlog, "gdbarch_update_p: "
+ "Architecture not found\n");
return 0;
}
if (new_gdbarch == target_gdbarch ())
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
- "Architecture %s (%s) unchanged\n",
- host_address_to_string (new_gdbarch),
- gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
+ gdb_printf (gdb_stdlog, "gdbarch_update_p: "
+ "Architecture %s (%s) unchanged\n",
+ host_address_to_string (new_gdbarch),
+ gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
return 1;
}
/* It's a new architecture, swap it in. */
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: "
- "New architecture %s (%s) selected\n",
- host_address_to_string (new_gdbarch),
- gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
+ gdb_printf (gdb_stdlog, "gdbarch_update_p: "
+ "New architecture %s (%s) selected\n",
+ host_address_to_string (new_gdbarch),
+ gdbarch_bfd_arch_info (new_gdbarch)->printable_name);
set_target_gdbarch (new_gdbarch);
return 1;
list of architectures. */
{
/* Append ``auto''. */
- arches.push_back ("auto");
+ set_architecture_string = "auto";
+ arches.push_back (set_architecture_string);
arches.push_back (nullptr);
set_show_commands architecture_cmds
= add_setshow_enum_cmd ("architecture", class_support,
show_gdbarch_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
- fprintf_filtered (file, _("Architecture debugging is %s.\n"), value);
+ gdb_printf (file, _("Architecture debugging is %s.\n"), value);
}
static const char *
gdbarch_tdep (struct gdbarch *gdbarch)
{
if (gdbarch_debug >= 2)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_tdep called\n");
+ gdb_printf (gdb_stdlog, "gdbarch_tdep called\n");
return gdbarch->tdep;
}
}
/* log it */
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
- bfd_arch_info->printable_name,
- host_address_to_string (init));
+ gdb_printf (gdb_stdlog, "register_gdbarch_init (%s, %s)\n",
+ bfd_arch_info->printable_name,
+ host_address_to_string (init));
/* Append it */
(*curr) = XNEW (struct gdbarch_registration);
(*curr)->bfd_architecture = bfd_architecture;
if (gdbarch_debug)
{
- fprintf_unfiltered (gdb_stdlog,
- "gdbarch_find_by_info: info.bfd_arch_info %s\n",
- (info.bfd_arch_info != NULL
- ? info.bfd_arch_info->printable_name
- : "(null)"));
- fprintf_unfiltered (gdb_stdlog,
- "gdbarch_find_by_info: info.byte_order %d (%s)\n",
- info.byte_order,
- (info.byte_order == BFD_ENDIAN_BIG ? "big"
- : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
- : "default"));
- fprintf_unfiltered (gdb_stdlog,
- "gdbarch_find_by_info: info.osabi %d (%s)\n",
- info.osabi, gdbarch_osabi_name (info.osabi));
- fprintf_unfiltered (gdb_stdlog,
- "gdbarch_find_by_info: info.abfd %s\n",
- host_address_to_string (info.abfd));
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: info.bfd_arch_info %s\n",
+ (info.bfd_arch_info != NULL
+ ? info.bfd_arch_info->printable_name
+ : "(null)"));
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: info.byte_order %d (%s)\n",
+ info.byte_order,
+ (info.byte_order == BFD_ENDIAN_BIG ? "big"
+ : info.byte_order == BFD_ENDIAN_LITTLE ? "little"
+ : "default"));
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: info.osabi %d (%s)\n",
+ info.osabi, gdbarch_osabi_name (info.osabi));
+ gdb_printf (gdb_stdlog,
+ "gdbarch_find_by_info: info.abfd %s\n",
+ host_address_to_string (info.abfd));
}
/* Find the tdep code that knows about this architecture. */
if (rego == NULL)
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
- "No matching architecture\n");
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ "No matching architecture\n");
return 0;
}
if (new_gdbarch == NULL)
{
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
- "Target rejected architecture\n");
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ "Target rejected architecture\n");
return NULL;
}
struct gdbarch_list **list;
struct gdbarch_list *self;
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
- "Previous architecture %s (%s) selected\n",
- host_address_to_string (new_gdbarch),
- new_gdbarch->bfd_arch_info->printable_name);
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ "Previous architecture %s (%s) selected\n",
+ host_address_to_string (new_gdbarch),
+ new_gdbarch->bfd_arch_info->printable_name);
/* Find the existing arch in the list. */
for (list = ®o->arches;
(*list) != NULL && (*list)->gdbarch != new_gdbarch;
/* It's a new architecture. */
if (gdbarch_debug)
- fprintf_unfiltered (gdb_stdlog, "gdbarch_find_by_info: "
- "New architecture %s (%s) selected\n",
- host_address_to_string (new_gdbarch),
- new_gdbarch->bfd_arch_info->printable_name);
+ gdb_printf (gdb_stdlog, "gdbarch_find_by_info: "
+ "New architecture %s (%s) selected\n",
+ host_address_to_string (new_gdbarch),
+ new_gdbarch->bfd_arch_info->printable_name);
/* Insert the new architecture into the front of the architecture
list (keep the list sorted Most Recently Used). */