diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:36:23 -0500 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2023-02-08 15:46:02 -0500 |
commit | c583a2520616c2736cffc389c89a48b159366e6c (patch) | |
tree | b4925f26506fcee96c16119431c01760f05db95d /gdb/arch-utils.c | |
parent | ca7f92c2f15b86b09c4a8ad14806bef666308d31 (diff) | |
download | binutils-users/simark/clang-format.zip binutils-users/simark/clang-format.tar.gz binutils-users/simark/clang-format.tar.bz2 |
Run clang-format.shusers/simark/clang-format
Change-Id: Ia948cc26d534b0dd02702244d52434b1a2093968
Diffstat (limited to 'gdb/arch-utils.c')
-rw-r--r-- | gdb/arch-utils.c | 316 |
1 files changed, 148 insertions, 168 deletions
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 6177682..59924ae 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -21,7 +21,7 @@ #include "arch-utils.h" #include "gdbcmd.h" -#include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */ +#include "inferior.h" /* enum CALL_DUMMY_LOCATION et al. */ #include "infrun.h" #include "regcache.h" #include "sim-regno.h" @@ -96,8 +96,8 @@ default_remove_non_address_bits (struct gdbarch *gdbarch, CORE_ADDR pointer) std::string default_memtag_to_string (struct gdbarch *gdbarch, struct value *tag) { - error (_("This architecture has no method to convert a memory tag to" - " a string.")); + error (_ ("This architecture has no method to convert a memory tag to" + " a string.")); } /* See arch-utils.h */ @@ -152,8 +152,8 @@ generic_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc) } int -generic_in_solib_return_trampoline (struct gdbarch *gdbarch, - CORE_ADDR pc, const char *name) +generic_in_solib_return_trampoline (struct gdbarch *gdbarch, CORE_ADDR pc, + const char *name) { return 0; } @@ -165,8 +165,7 @@ generic_stack_frame_destroyed_p (struct gdbarch *gdbarch, CORE_ADDR pc) } int -default_code_of_frame_writable (struct gdbarch *gdbarch, - frame_info_ptr frame) +default_code_of_frame_writable (struct gdbarch *gdbarch, frame_info_ptr frame) { return 1; } @@ -256,10 +255,8 @@ cannot_register_not (struct gdbarch *gdbarch, int regnum) cooked or raw. */ void -legacy_virtual_frame_pointer (struct gdbarch *gdbarch, - CORE_ADDR pc, - int *frame_regnum, - LONGEST *frame_offset) +legacy_virtual_frame_pointer (struct gdbarch *gdbarch, CORE_ADDR pc, + int *frame_regnum, LONGEST *frame_offset) { /* FIXME: cagney/2002-09-13: This code is used when identifying the frame pointer of the current PC. It is assuming that a single @@ -267,17 +264,15 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, instead generate a byte code expression as that would work better with things like Dwarf2's CFI. */ if (gdbarch_deprecated_fp_regnum (gdbarch) >= 0 - && gdbarch_deprecated_fp_regnum (gdbarch) - < gdbarch_num_regs (gdbarch)) + && gdbarch_deprecated_fp_regnum (gdbarch) < gdbarch_num_regs (gdbarch)) *frame_regnum = gdbarch_deprecated_fp_regnum (gdbarch); else if (gdbarch_sp_regnum (gdbarch) >= 0 - && gdbarch_sp_regnum (gdbarch) - < gdbarch_num_regs (gdbarch)) + && gdbarch_sp_regnum (gdbarch) < gdbarch_num_regs (gdbarch)) *frame_regnum = gdbarch_sp_regnum (gdbarch); else /* Should this be an internal error? I guess so, it is reflecting an architectural limitation in the current design. */ - internal_error (_("No virtual frame pointer available")); + internal_error (_ ("No virtual frame pointer available")); *frame_offset = 0; } @@ -286,8 +281,8 @@ legacy_virtual_frame_pointer (struct gdbarch *gdbarch, If no suitable type is found, return NULL. */ const struct floatformat ** -default_floatformat_for_type (struct gdbarch *gdbarch, - const char *name, int len) +default_floatformat_for_type (struct gdbarch *gdbarch, const char *name, + int len) { const struct floatformat **format = NULL; @@ -315,7 +310,7 @@ default_floatformat_for_type (struct gdbarch *gdbarch, return format; } - + int generic_convert_register_p (struct gdbarch *gdbarch, int regnum, struct type *type) @@ -337,8 +332,7 @@ generic_instruction_nullified (struct gdbarch *gdbarch, } int -default_remote_register_number (struct gdbarch *gdbarch, - int regno) +default_remote_register_number (struct gdbarch *gdbarch, int regno) { return regno; } @@ -351,7 +345,6 @@ default_vsyscall_range (struct gdbarch *gdbarch, struct mem_range *range) return 0; } - /* Functions to manipulate the endianness of the target. */ static enum bfd_endian target_byte_order_user = BFD_ENDIAN_UNKNOWN; @@ -359,8 +352,7 @@ static enum bfd_endian target_byte_order_user = BFD_ENDIAN_UNKNOWN; static const char endian_big[] = "big"; static const char endian_little[] = "little"; static const char endian_auto[] = "auto"; -static const char *const endian_enum[] = -{ +static const char *const endian_enum[] = { endian_big, endian_little, endian_auto, @@ -382,18 +374,15 @@ show_endian (struct ui_file *file, int from_tty, struct cmd_list_element *c, { if (target_byte_order_user == BFD_ENDIAN_UNKNOWN) if (gdbarch_byte_order (get_current_arch ()) == BFD_ENDIAN_BIG) - gdb_printf (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 - gdb_printf (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) + gdb_printf (file, _ ("The target is set to big endian.\n")); else - if (target_byte_order_user == BFD_ENDIAN_BIG) - gdb_printf (file, - _("The target is set to big endian.\n")); - else - gdb_printf (file, - _("The target is set to little endian.\n")); + gdb_printf (file, _ ("The target is set to little endian.\n")); } static void @@ -404,29 +393,29 @@ set_endian (const char *ignore_args, int from_tty, struct cmd_list_element *c) if (set_endian_string == endian_auto) { target_byte_order_user = BFD_ENDIAN_UNKNOWN; - if (! gdbarch_update_p (info)) - internal_error (_("set_endian: architecture update failed")); + if (!gdbarch_update_p (info)) + internal_error (_ ("set_endian: architecture update failed")); } else if (set_endian_string == endian_little) { info.byte_order = BFD_ENDIAN_LITTLE; - if (! gdbarch_update_p (info)) + if (!gdbarch_update_p (info)) gdb_printf (gdb_stderr, - _("Little endian target not supported by GDB\n")); + _ ("Little endian target not supported by GDB\n")); else target_byte_order_user = BFD_ENDIAN_LITTLE; } else if (set_endian_string == endian_big) { info.byte_order = BFD_ENDIAN_BIG; - if (! gdbarch_update_p (info)) + if (!gdbarch_update_p (info)) gdb_printf (gdb_stderr, - _("Big endian target not supported by GDB\n")); + _ ("Big endian target not supported by GDB\n")); else target_byte_order_user = BFD_ENDIAN_BIG; } else - internal_error (_("set_endian: bad value")); + internal_error (_ ("set_endian: bad value")); show_endian (gdb_stdout, from_tty, NULL, NULL); } @@ -485,8 +474,8 @@ choose_architecture_for_target (const struct target_desc *target_desc, if (tdesc_compatible_p (target_desc, selected)) return from_target; - warning (_("Selected architecture %s is not compatible " - "with reported target architecture %s"), + warning (_ ("Selected architecture %s is not compatible " + "with reported target architecture %s"), selected->printable_name, from_target->printable_name); return selected; } @@ -509,15 +498,19 @@ choose_architecture_for_target (const struct target_desc *target_desc, /* We have no idea which one is better. This is a bug, but not a critical problem; warn the user. */ - warning (_("Selected architecture %s is ambiguous with " - "reported target architecture %s"), + warning (_ ("Selected architecture %s is ambiguous with " + "reported target architecture %s"), selected->printable_name, from_target->printable_name); return selected; } /* Functions to manipulate the architecture of the target. */ -enum set_arch { set_arch_auto, set_arch_manual }; +enum set_arch +{ + set_arch_auto, + set_arch_manual +}; static const struct bfd_arch_info *target_architecture_user; @@ -540,21 +533,21 @@ show_architecture (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { if (target_architecture_user == NULL) - gdb_printf (file, _("The target architecture is set to " - "\"auto\" (currently \"%s\").\n"), + gdb_printf (file, + _ ("The target architecture is set to " + "\"auto\" (currently \"%s\").\n"), gdbarch_bfd_arch_info (get_current_arch ())->printable_name); else - gdb_printf (file, _("The target architecture is set to \"%s\".\n"), + gdb_printf (file, _ ("The target architecture is set to \"%s\".\n"), set_architecture_string); } - /* Called if the user enters ``set architecture'' with or without an argument. */ static void -set_architecture (const char *ignore_args, - int from_tty, struct cmd_list_element *c) +set_architecture (const char *ignore_args, int from_tty, + struct cmd_list_element *c) { struct gdbarch_info info; @@ -562,18 +555,17 @@ set_architecture (const char *ignore_args, { target_architecture_user = NULL; if (!gdbarch_update_p (info)) - internal_error (_("could not select an architecture automatically")); + internal_error (_ ("could not select an architecture automatically")); } else { info.bfd_arch_info = bfd_scan_arch (set_architecture_string); if (info.bfd_arch_info == NULL) - internal_error (_("set_architecture: bfd_scan_arch failed")); + internal_error (_ ("set_architecture: bfd_scan_arch failed")); if (gdbarch_update_p (info)) target_architecture_user = info.bfd_arch_info; else - gdb_printf (gdb_stderr, - _("Architecture `%s' not recognized.\n"), + gdb_printf (gdb_stderr, _ ("Architecture `%s' not recognized.\n"), set_architecture_string); } show_architecture (gdb_stdout, from_tty, NULL, NULL); @@ -603,7 +595,7 @@ gdbarch_update_p (struct gdbarch_info info) { if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_update_p: " - "Architecture not found\n"); + "Architecture not found\n"); return 0; } @@ -612,7 +604,8 @@ gdbarch_update_p (struct gdbarch_info info) if (new_gdbarch == target_gdbarch ()) { if (gdbarch_debug) - gdb_printf (gdb_stdlog, "gdbarch_update_p: " + 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); @@ -621,7 +614,8 @@ gdbarch_update_p (struct gdbarch_info info) /* It's a new architecture, swap it in. */ if (gdbarch_debug) - gdb_printf (gdb_stdlog, "gdbarch_update_p: " + 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); @@ -656,7 +650,7 @@ set_gdbarch_from_file (bfd *abfd) gdbarch = gdbarch_find_by_info (info); if (gdbarch == NULL) - error (_("Architecture of file not recognized.")); + error (_ ("Architecture of file not recognized.")); set_target_gdbarch (gdbarch); } @@ -688,7 +682,7 @@ void initialize_current_architecture (void) { arches = gdbarch_printable_names (); - + /* Find a default architecture. */ if (default_bfd_arch == NULL) { @@ -703,19 +697,18 @@ initialize_current_architecture (void) } if (chosen == NULL) - internal_error (_("initialize_current_architecture: No arch")); + internal_error (_ ("initialize_current_architecture: No arch")); default_bfd_arch = bfd_scan_arch (chosen); if (default_bfd_arch == NULL) - internal_error (_("initialize_current_architecture: Arch not found")); + internal_error (_ ("initialize_current_architecture: Arch not found")); } gdbarch_info info; info.bfd_arch_info = default_bfd_arch; /* Take several guesses at a byte order. */ - if (default_byte_order == BFD_ENDIAN_UNKNOWN - && default_bfd_vec != NULL) + if (default_byte_order == BFD_ENDIAN_UNKNOWN && default_bfd_vec != NULL) { /* Extract BFD's default vector's byte order. */ switch (default_bfd_vec->byteorder) @@ -735,9 +728,7 @@ initialize_current_architecture (void) /* look for ``*el-*'' in the target name. */ const char *chp; chp = strchr (target_name, '-'); - if (chp != NULL - && chp - 2 >= target_name - && startswith (chp - 2, "el")) + if (chp != NULL && chp - 2 >= target_name && startswith (chp - 2, "el")) default_byte_order = BFD_ENDIAN_LITTLE; } if (default_byte_order == BFD_ENDIAN_UNKNOWN) @@ -749,9 +740,9 @@ initialize_current_architecture (void) info.byte_order = default_byte_order; info.byte_order_for_code = info.byte_order; - if (! gdbarch_update_p (info)) - internal_error (_("initialize_current_architecture: Selection of " - "initial architecture failed")); + if (!gdbarch_update_p (info)) + internal_error (_ ("initialize_current_architecture: Selection of " + "initial architecture failed")); /* Create the ``set architecture'' command appending ``auto'' to the list of architectures. */ @@ -760,13 +751,10 @@ initialize_current_architecture (void) 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, - arches.data (), &set_architecture_string, - _("Set architecture of target."), - _("Show architecture of target."), NULL, - set_architecture, show_architecture, - &setlist, &showlist); + set_show_commands architecture_cmds = add_setshow_enum_cmd ( + "architecture", class_support, arches.data (), &set_architecture_string, + _ ("Set architecture of target."), _ ("Show architecture of target."), + NULL, set_architecture, show_architecture, &setlist, &showlist); add_alias_cmd ("processor", architecture_cmds.set, class_support, 1, &setlist); } @@ -780,19 +768,17 @@ void gdbarch_info_fill (struct gdbarch_info *info) { /* "(gdb) set architecture ...". */ - if (info->bfd_arch_info == NULL - && target_architecture_user) + if (info->bfd_arch_info == NULL && target_architecture_user) info->bfd_arch_info = target_architecture_user; /* From the file. */ - if (info->bfd_arch_info == NULL - && info->abfd != NULL + if (info->bfd_arch_info == NULL && info->abfd != NULL && bfd_get_arch (info->abfd) != bfd_arch_unknown && bfd_get_arch (info->abfd) != bfd_arch_obscure) info->bfd_arch_info = bfd_get_arch_info (info->abfd); /* From the target. */ if (info->target_desc != NULL) - info->bfd_arch_info = choose_architecture_for_target - (info->target_desc, info->bfd_arch_info); + info->bfd_arch_info = choose_architecture_for_target (info->target_desc, + info->bfd_arch_info); /* From the default. */ if (info->bfd_arch_info == NULL) info->bfd_arch_info = default_bfd_arch; @@ -802,11 +788,10 @@ gdbarch_info_fill (struct gdbarch_info *info) && target_byte_order_user != BFD_ENDIAN_UNKNOWN) info->byte_order = target_byte_order_user; /* From the INFO struct. */ - if (info->byte_order == BFD_ENDIAN_UNKNOWN - && info->abfd != NULL) - info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG + if (info->byte_order == BFD_ENDIAN_UNKNOWN && info->abfd != NULL) + info->byte_order = (bfd_big_endian (info->abfd) ? BFD_ENDIAN_BIG : bfd_little_endian (info->abfd) ? BFD_ENDIAN_LITTLE - : BFD_ENDIAN_UNKNOWN); + : BFD_ENDIAN_UNKNOWN); /* From the default. */ if (info->byte_order == BFD_ENDIAN_UNKNOWN) info->byte_order = default_byte_order; @@ -822,7 +807,7 @@ gdbarch_info_fill (struct gdbarch_info *info) if (info->osabi == GDB_OSABI_UNKNOWN && info->target_desc != NULL) info->osabi = tdesc_osabi (info->target_desc); - /* From the configured default. */ + /* From the configured default. */ #ifdef GDB_OSABI_DEFAULT if (info->osabi == GDB_OSABI_UNKNOWN) info->osabi = GDB_OSABI_DEFAULT; @@ -878,6 +863,7 @@ default_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, return gdbarch_sw_breakpoint_from_kind (gdbarch, kind, lenptr); } + int default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, struct regcache *regcache, @@ -886,13 +872,11 @@ default_breakpoint_kind_from_current_state (struct gdbarch *gdbarch, return gdbarch_breakpoint_kind_from_pc (gdbarch, pcptr); } - void -default_gen_return_address (struct gdbarch *gdbarch, - struct agent_expr *ax, struct axs_value *value, - CORE_ADDR scope) +default_gen_return_address (struct gdbarch *gdbarch, struct agent_expr *ax, + struct axs_value *value, CORE_ADDR scope) { - error (_("This architecture has no method to collect a return address.")); + error (_ ("This architecture has no method to collect a return address.")); } int @@ -905,17 +889,20 @@ default_return_in_first_hidden_param_p (struct gdbarch *gdbarch, return !(language_pass_by_reference (type).trivially_copyable); } -int default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr) +int +default_insn_is_call (struct gdbarch *gdbarch, CORE_ADDR addr) { return 0; } -int default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr) +int +default_insn_is_ret (struct gdbarch *gdbarch, CORE_ADDR addr) { return 0; } -int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) +int +default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) { return 0; } @@ -923,11 +910,11 @@ int default_insn_is_jump (struct gdbarch *gdbarch, CORE_ADDR addr) /* See arch-utils.h. */ bool -default_program_breakpoint_here_p (struct gdbarch *gdbarch, - CORE_ADDR address) +default_program_breakpoint_here_p (struct gdbarch *gdbarch, CORE_ADDR address) { int len; - const gdb_byte *bpoint = gdbarch_breakpoint_from_pc (gdbarch, &address, &len); + const gdb_byte *bpoint + = gdbarch_breakpoint_from_pc (gdbarch, &address, &len); /* Software breakpoints unsupported? */ if (bpoint == nullptr) @@ -967,7 +954,8 @@ default_skip_permanent_breakpoint (struct regcache *regcache) CORE_ADDR default_infcall_mmap (CORE_ADDR size, unsigned prot) { - error (_("This target does not support inferior memory allocation by mmap.")); + error ( + _ ("This target does not support inferior memory allocation by mmap.")); } void @@ -983,8 +971,8 @@ std::string default_gcc_target_options (struct gdbarch *gdbarch) { return string_printf ("-m%d%s", gdbarch_ptr_bit (gdbarch), - (gdbarch_ptr_bit (gdbarch) == 64 - ? " -mcmodel=large" : "")); + (gdbarch_ptr_bit (gdbarch) == 64 ? " -mcmodel=large" + : "")); } /* gdbarch gnu_triplet_regexp method. */ @@ -1008,8 +996,7 @@ default_addressable_memory_unit_size (struct gdbarch *gdbarch) void default_guess_tracepoint_registers (struct gdbarch *gdbarch, - struct regcache *regcache, - CORE_ADDR addr) + struct regcache *regcache, CORE_ADDR addr) { int pc_regno = gdbarch_pc_regnum (gdbarch); gdb_byte *regs; @@ -1034,8 +1021,9 @@ default_print_insn (bfd_vma memaddr, disassemble_info *info) { disassembler_ftype disassemble_fn; - disassemble_fn = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG, - info->mach, current_program_space->exec_bfd ()); + disassemble_fn + = disassembler (info->arch, info->endian == BFD_ENDIAN_BIG, info->mach, + current_program_space->exec_bfd ()); gdb_assert (disassemble_fn != NULL); return (*disassemble_fn) (memaddr, info); @@ -1053,7 +1041,8 @@ gdbarch_skip_prologue_noexcept (gdbarch *gdbarch, CORE_ADDR pc) noexcept new_pc = gdbarch_skip_prologue (gdbarch, pc); } catch (const gdb_exception &ex) - {} + { + } return new_pc; } @@ -1084,11 +1073,10 @@ default_get_pc_address_flags (frame_info_ptr frame, CORE_ADDR pc) /* See arch-utils.h. */ void -default_read_core_file_mappings - (struct gdbarch *gdbarch, - struct bfd *cbfd, - read_core_file_mappings_pre_loop_ftype pre_loop_cb, - read_core_file_mappings_loop_ftype loop_cb) +default_read_core_file_mappings ( + struct gdbarch *gdbarch, struct bfd *cbfd, + read_core_file_mappings_pre_loop_ftype pre_loop_cb, + read_core_file_mappings_loop_ftype loop_cb) { } @@ -1104,11 +1092,12 @@ default_get_return_buf_addr (struct type *val_type, frame_info_ptr cur_frame) #define GDBARCH_DEBUG 0 #endif unsigned int gdbarch_debug = GDBARCH_DEBUG; + static void show_gdbarch_debug (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - gdb_printf (file, _("Architecture debugging is %s.\n"), value); + gdb_printf (file, _ ("Architecture debugging is %s.\n"), value); } static const char * @@ -1169,10 +1158,10 @@ pstring_list (const char *const *list) #include "gdbarch.c" enum return_value_convention -default_gdbarch_return_value - (struct gdbarch *gdbarch, struct value *function, struct type *valtype, - struct regcache *regcache, struct value **read_value, - const gdb_byte *writebuf) +default_gdbarch_return_value (struct gdbarch *gdbarch, struct value *function, + struct type *valtype, struct regcache *regcache, + struct value **read_value, + const gdb_byte *writebuf) { gdb_byte *readbuf = nullptr; @@ -1182,11 +1171,12 @@ default_gdbarch_return_value readbuf = value_contents_raw (*read_value).data (); } - return gdbarch->return_value (gdbarch, function, valtype, regcache, - readbuf, writebuf); + return gdbarch->return_value (gdbarch, function, valtype, regcache, readbuf, + writebuf); } -obstack *gdbarch_obstack (gdbarch *arch) +obstack * +gdbarch_obstack (gdbarch *arch) { return &arch->obstack; } @@ -1199,7 +1189,6 @@ gdbarch_obstack_strdup (struct gdbarch *arch, const char *string) return obstack_strdup (&arch->obstack, string); } - /* Free a gdbarch struct. This should never happen in normal operation --- once you've created a gdbarch, you keep it around. However, if an architecture's init function encounters an error @@ -1251,14 +1240,13 @@ gdbarch_printable_names () architectures. */ std::vector<const char *> arches; - for (gdbarch_registration *rego = gdbarch_registry; - rego != nullptr; + for (gdbarch_registration *rego = gdbarch_registry; rego != nullptr; rego = rego->next) { const struct bfd_arch_info *ap = bfd_lookup_arch (rego->bfd_architecture, 0); if (ap == nullptr) - internal_error (_("gdbarch_architecture_names: multi-arch unknown")); + internal_error (_ ("gdbarch_architecture_names: multi-arch unknown")); do { if (rego->supports_arch_info == nullptr @@ -1272,11 +1260,9 @@ gdbarch_printable_names () return arches; } - void gdbarch_register (enum bfd_architecture bfd_architecture, - gdbarch_init_ftype *init, - gdbarch_dump_tdep_ftype *dump_tdep, + gdbarch_init_ftype *init, gdbarch_dump_tdep_ftype *dump_tdep, gdbarch_supports_arch_info_ftype *supports_arch_info) { struct gdbarch_registration **curr; @@ -1286,25 +1272,22 @@ gdbarch_register (enum bfd_architecture bfd_architecture, bfd_arch_info = bfd_lookup_arch (bfd_architecture, 0); if (bfd_arch_info == NULL) { - internal_error (_("gdbarch: Attempt to register " - "unknown architecture (%d)"), + internal_error (_ ("gdbarch: Attempt to register " + "unknown architecture (%d)"), bfd_architecture); } /* Check that we haven't seen this architecture before. */ - for (curr = &gdbarch_registry; - (*curr) != NULL; - curr = &(*curr)->next) + for (curr = &gdbarch_registry; (*curr) != NULL; curr = &(*curr)->next) { if (bfd_architecture == (*curr)->bfd_architecture) - internal_error (_("gdbarch: Duplicate registration " - "of architecture (%s)"), + internal_error (_ ("gdbarch: Duplicate registration " + "of architecture (%s)"), bfd_arch_info->printable_name); } /* log it */ if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_register (%s, %s)\n", - bfd_arch_info->printable_name, - host_address_to_string (init)); + bfd_arch_info->printable_name, host_address_to_string (init)); /* Append it */ (*curr) = XNEW (struct gdbarch_registration); (*curr)->bfd_architecture = bfd_architecture; @@ -1336,7 +1319,6 @@ gdbarch_list_lookup_by_info (struct gdbarch_list *arches, return NULL; } - /* Find an architecture that matches the specified INFO. Create a new architecture if needed. Return that new architecture. */ @@ -1356,36 +1338,31 @@ gdbarch_find_by_info (struct gdbarch_info info) if (gdbarch_debug) { - gdb_printf (gdb_stdlog, - "gdbarch_find_by_info: info.bfd_arch_info %s\n", + gdb_printf (gdb_stdlog, "gdbarch_find_by_info: info.bfd_arch_info %s\n", (info.bfd_arch_info != nullptr - ? info.bfd_arch_info->printable_name - : "(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_BIG ? "big" : info.byte_order == BFD_ENDIAN_LITTLE ? "little" - : "default")); - gdb_printf (gdb_stdlog, - "gdbarch_find_by_info: info.osabi %d (%s)\n", + : "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", + 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. */ - for (rego = gdbarch_registry; - rego != nullptr; - rego = rego->next) + for (rego = gdbarch_registry; rego != nullptr; rego = rego->next) if (rego->bfd_architecture == info.bfd_arch_info->arch) break; if (rego == nullptr) { if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " - "No matching architecture\n"); + "No matching architecture\n"); return nullptr; } @@ -1398,7 +1375,7 @@ gdbarch_find_by_info (struct gdbarch_info info) { if (gdbarch_debug) gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " - "Target rejected architecture\n"); + "Target rejected architecture\n"); return nullptr; } @@ -1410,14 +1387,16 @@ gdbarch_find_by_info (struct gdbarch_info info) struct gdbarch_list **list; struct gdbarch_list *self; if (gdbarch_debug) - gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " + 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) != nullptr && (*list)->gdbarch != new_gdbarch; - list = &(*list)->next); + list = &(*list)->next) + ; /* It had better be in the list of architectures. */ gdb_assert ((*list) != nullptr && (*list)->gdbarch == new_gdbarch); /* Unlink SELF. */ @@ -1432,7 +1411,8 @@ gdbarch_find_by_info (struct gdbarch_info info) /* It's a new architecture. */ if (gdbarch_debug) - gdb_printf (gdb_stdlog, "gdbarch_find_by_info: " + 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); @@ -1479,20 +1459,20 @@ target_gdbarch (void) } void _initialize_gdbarch_utils (); + void _initialize_gdbarch_utils () { - add_setshow_enum_cmd ("endian", class_support, - endian_enum, &set_endian_string, - _("Set endianness of target."), - _("Show endianness of target."), - NULL, set_endian, show_endian, - &setlist, &showlist); - add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _("\ -Set architecture debugging."), _("\ -Show architecture debugging."), _("\ + add_setshow_enum_cmd ("endian", class_support, endian_enum, + &set_endian_string, _ ("Set endianness of target."), + _ ("Show endianness of target."), NULL, set_endian, + show_endian, &setlist, &showlist); + add_setshow_zuinteger_cmd ("arch", class_maintenance, &gdbarch_debug, _ ("\ +Set architecture debugging."), + _ ("\ +Show architecture debugging."), + _ ("\ When non-zero, architecture debugging is enabled."), - NULL, - show_gdbarch_debug, - &setdebuglist, &showdebuglist); + NULL, show_gdbarch_debug, &setdebuglist, + &showdebuglist); } |