From: Ulrich Weigand Date: Tue, 26 Aug 2008 17:21:29 +0000 (+0000) Subject: * gdbarch.sh (target_gdbarch): New global variable. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1cf3db46a678ced9d729572de9232fab9c00350d;p=binutils-gdb.git * gdbarch.sh (target_gdbarch): New global variable. (deprecated_current_gdbarch_select_hack): Set it. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead of current_gdbarch. * target-descriptions.c (target_find_description): Likewise. * arm-tdep.c (arm_update_current_architecture): Likewise. (show_fp_model, arm_show_abi, arm_show_fallback_mode, arm_show_force_mode): Likewise. * mips-tdep.c (show_mask_address, show_mipsfpu_command, show_mips_abi): Likewise. * mep-tdep.c (me_module_register_set, current_me_module): Likewise. * target.c (target_translate_tls_address): Use target_gdbarch instead of current_gdbarch. * remote.c (struct packet_reg): Likewise. (get_remote_arch_state, packet_reg_from_regnum, packet_reg_from_pnum, remote_check_symbols, remote_wait, remote_address_masked, remote_insert_breakpoint, remote_insert_hw_breakpoint, remote_read_description): Likewise. * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. * solib.c (solib_open, solib_map_sections, solib_read_symbols, solib_add, info_sharedlibrary_command, solib_address, solib_create_inferior_hook, in_solib_dynsym_resolve_code, solib_global_lookup): Likewise. * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): Likewise. * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): Likewise. * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, nto_truncate_ptr): Likewise. * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index d9745da50ac..0ab3596d1d6 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,45 @@ +2008-08-26 Ulrich Weigand + + * gdbarch.sh (target_gdbarch): New global variable. + (deprecated_current_gdbarch_select_hack): Set it. + * gdbarch.c, gdbarch.h: Regenerate. + + * arch-utils.c (gdbarch_update_p): Use target_gdbarch instead + of current_gdbarch. + * target-descriptions.c (target_find_description): Likewise. + * arm-tdep.c (arm_update_current_architecture): Likewise. + (show_fp_model, arm_show_abi, arm_show_fallback_mode, + arm_show_force_mode): Likewise. + * mips-tdep.c (show_mask_address, show_mipsfpu_command, + show_mips_abi): Likewise. + * mep-tdep.c (me_module_register_set, current_me_module): Likewise. + + * target.c (target_translate_tls_address): Use target_gdbarch + instead of current_gdbarch. + * remote.c (struct packet_reg): Likewise. + (get_remote_arch_state, packet_reg_from_regnum, + packet_reg_from_pnum, remote_check_symbols, remote_wait, + remote_address_masked, remote_insert_breakpoint, + remote_insert_hw_breakpoint, remote_read_description): Likewise. + * remote-m32r-sdi.c (m32r_resume, m32r_wait): Likewise. + * remote-mips.c (mips_open, mips_common_breakpoint): Likewise. + * cris-tdep.c (cris_can_use_hardware_watchpoint): Likewise. + + * solib.c (solib_open, solib_map_sections, solib_read_symbols, + solib_add, info_sharedlibrary_command, solib_address, + solib_create_inferior_hook, in_solib_dynsym_resolve_code, + solib_global_lookup): Likewise. + * solib-frv.c (enable_break2, frv_relocate_main_executable): Likewise. + * solib-irix.c (irix_current_sos, irix_open_symbol_file_object): + Likewise. + * solib-sunos.c (sunos_solib_create_inferior_hook): Likewise. + * solib-svr4.c (exec_entry_point, enable_break, svr4_free_so, + set_solib_svr4_fetch_link_map_offsets, svr4_fetch_link_map_offsets): + Likewise. + * nto-tdep.c (nto_find_and_open_solib, nto_init_solib_absolute_prefix, + nto_truncate_ptr): Likewise. + * mips-linux-tdep.c (mips_linux_in_dynsym_stub): Likewise. + 2008-08-26 Luis Machado * ppc-linux-tdep.c (ppc_linux_vsx_regset_sections) New structure. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index a2fd7b65661..13aee27d64c 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -491,7 +491,7 @@ gdbarch_update_p (struct gdbarch_info info) /* If it is the same old architecture, accept the request (but don't swap anything). */ - if (new_gdbarch == current_gdbarch) + if (new_gdbarch == target_gdbarch) { if (gdbarch_debug) fprintf_unfiltered (gdb_stdlog, "gdbarch_update_p: " diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index ba18f9a9bf2..8c05a5ce0be 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -2704,7 +2704,7 @@ arm_update_current_architecture (void) struct gdbarch_info info; /* If the current architecture is not ARM, we have nothing to do. */ - if (gdbarch_bfd_arch_info (current_gdbarch)->arch != bfd_arch_arm) + if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_arm) return; /* Update the architecture. */ @@ -2738,10 +2738,10 @@ static void show_fp_model (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); if (arm_fp_model == ARM_FLOAT_AUTO - && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm) + && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_arm) fprintf_filtered (file, _("\ The current ARM floating point model is \"auto\" (currently \"%s\").\n"), fp_model_strings[tdep->fp_model]); @@ -2775,10 +2775,10 @@ static void arm_show_abi (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); if (arm_abi_global == ARM_ABI_AUTO - && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_arm) + && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_arm) fprintf_filtered (file, _("\ The current ARM ABI is \"auto\" (currently \"%s\").\n"), arm_abi_strings[tdep->arm_abi]); @@ -2791,7 +2791,7 @@ static void arm_show_fallback_mode (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); fprintf_filtered (file, _("\ The current execution mode assumed (when symbols are unavailable) is \"%s\".\n"), @@ -2802,7 +2802,7 @@ static void arm_show_force_mode (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); fprintf_filtered (file, _("\ The current execution mode assumed (even when symbols are available) is \"%s\".\n"), diff --git a/gdb/cris-tdep.c b/gdb/cris-tdep.c index d2c0c2ca63a..aec54bf7142 100644 --- a/gdb/cris-tdep.c +++ b/gdb/cris-tdep.c @@ -498,7 +498,7 @@ crisv32_single_step_through_delay (struct gdbarch *gdbarch, int cris_can_use_hardware_watchpoint (int type, int count, int other) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); /* No bookkeeping is done here; it is handled by the remote debug agent. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index cfe8be1c49c..aa5063e1102 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -377,6 +377,7 @@ struct gdbarch startup_gdbarch = }; struct gdbarch *current_gdbarch = &startup_gdbarch; +struct gdbarch *target_gdbarch = &startup_gdbarch; /* Create a new ``struct gdbarch'' based on information provided by ``struct gdbarch_info''. */ @@ -3666,6 +3667,7 @@ deprecated_current_gdbarch_select_hack (struct gdbarch *new_gdbarch) gdb_assert (current_gdbarch != NULL); gdb_assert (new_gdbarch->initialized_p); current_gdbarch = new_gdbarch; + target_gdbarch = new_gdbarch; observer_notify_architecture_changed (new_gdbarch); registers_changed (); } diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 24d8c6bbc68..0a81e27e8b0 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -54,6 +54,7 @@ struct displaced_step_closure; struct core_regset_section; extern struct gdbarch *current_gdbarch; +extern struct gdbarch *target_gdbarch; /* The following are pre-initialized by GDBARCH. */ diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 222751d2e35..156311e89b1 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -822,6 +822,7 @@ struct displaced_step_closure; struct core_regset_section; extern struct gdbarch *current_gdbarch; +extern struct gdbarch *target_gdbarch; EOF # function typedef's @@ -1281,6 +1282,7 @@ cat <initialized_p); current_gdbarch = new_gdbarch; + target_gdbarch = new_gdbarch; observer_notify_architecture_changed (new_gdbarch); registers_changed (); } diff --git a/gdb/mep-tdep.c b/gdb/mep-tdep.c index 83a41c7ac0e..0aab939d720 100644 --- a/gdb/mep-tdep.c +++ b/gdb/mep-tdep.c @@ -264,7 +264,7 @@ me_module_register_set (CONFIG_ATTR me_module, mask contains any of the me_module's coprocessor ISAs, specifically excluding the generic coprocessor register sets. */ - CGEN_CPU_DESC desc = gdbarch_tdep (current_gdbarch)->cpu_desc; + CGEN_CPU_DESC desc = gdbarch_tdep (target_gdbarch)->cpu_desc; const CGEN_HW_ENTRY *hw; if (me_module == CONFIG_NONE) @@ -855,7 +855,7 @@ current_me_module () return regval; } else - return gdbarch_tdep (current_gdbarch)->me_module; + return gdbarch_tdep (target_gdbarch)->me_module; } diff --git a/gdb/mips-linux-tdep.c b/gdb/mips-linux-tdep.c index 8f30aef45ff..78f33a66536 100644 --- a/gdb/mips-linux-tdep.c +++ b/gdb/mips-linux-tdep.c @@ -603,7 +603,7 @@ mips_linux_in_dynsym_stub (CORE_ADDR pc, char *name) { unsigned char buf[28], *p; ULONGEST insn, insn1; - int n64 = (mips_abi (current_gdbarch) == MIPS_ABI_N64); + int n64 = (mips_abi (target_gdbarch) == MIPS_ABI_N64); read_memory (pc - 12, buf, 28); diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 4469754d9e1..b6755421ee9 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -778,7 +778,7 @@ static void show_mask_address (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (target_gdbarch); deprecated_show_value_hack (file, from_tty, c, value); switch (mask_address_var) @@ -4788,7 +4788,7 @@ show_mipsfpu_command (char *args, int from_tty) { char *fpu; - if (gdbarch_bfd_arch_info (current_gdbarch)->arch != bfd_arch_mips) + if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_mips) { printf_unfiltered ("The MIPS floating-point coprocessor is unknown " @@ -4796,7 +4796,7 @@ show_mipsfpu_command (char *args, int from_tty) return; } - switch (MIPS_FPU_TYPE (current_gdbarch)) + switch (MIPS_FPU_TYPE (target_gdbarch)) { case MIPS_FPU_SINGLE: fpu = "single-precision"; @@ -5958,7 +5958,7 @@ show_mips_abi (struct ui_file *file, struct cmd_list_element *ignored_cmd, const char *ignored_value) { - if (gdbarch_bfd_arch_info (current_gdbarch)->arch != bfd_arch_mips) + if (gdbarch_bfd_arch_info (target_gdbarch)->arch != bfd_arch_mips) fprintf_filtered (file, "The MIPS ABI is unknown because the current architecture " @@ -5966,7 +5966,7 @@ show_mips_abi (struct ui_file *file, else { enum mips_abi global_abi = global_mips_abi (); - enum mips_abi actual_abi = mips_abi (current_gdbarch); + enum mips_abi actual_abi = mips_abi (target_gdbarch); const char *actual_abi_str = mips_abi_strings[actual_abi]; if (global_abi == MIPS_ABI_UNKNOWN) diff --git a/gdb/nto-tdep.c b/gdb/nto-tdep.c index bf321b86018..38fb03d35d0 100644 --- a/gdb/nto-tdep.c +++ b/gdb/nto-tdep.c @@ -107,14 +107,14 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) #define PATH_FMT "%s/lib:%s/usr/lib:%s/usr/photon/lib:%s/usr/photon/dll:%s/lib/dll" nto_root = nto_target (); - if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0) + if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "i386") == 0) { arch = "x86"; endian = ""; } - else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, + else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "rs6000") == 0 - || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, + || strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "powerpc") == 0) { arch = "ppc"; @@ -122,8 +122,8 @@ nto_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) } else { - arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name; - endian = gdbarch_byte_order (current_gdbarch) + arch = gdbarch_bfd_arch_info (target_gdbarch)->arch_name; + endian = gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG ? "be" : "le"; } @@ -169,14 +169,14 @@ nto_init_solib_absolute_prefix (void) const char *arch; nto_root = nto_target (); - if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, "i386") == 0) + if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "i386") == 0) { arch = "x86"; endian = ""; } - else if (strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, + else if (strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "rs6000") == 0 - || strcmp (gdbarch_bfd_arch_info (current_gdbarch)->arch_name, + || strcmp (gdbarch_bfd_arch_info (target_gdbarch)->arch_name, "powerpc") == 0) { arch = "ppc"; @@ -184,8 +184,8 @@ nto_init_solib_absolute_prefix (void) } else { - arch = gdbarch_bfd_arch_info (current_gdbarch)->arch_name; - endian = gdbarch_byte_order (current_gdbarch) + arch = gdbarch_bfd_arch_info (target_gdbarch)->arch_name; + endian = gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG ? "be" : "le"; } @@ -291,12 +291,12 @@ LM_ADDR (struct so_list *so) static CORE_ADDR nto_truncate_ptr (CORE_ADDR addr) { - if (gdbarch_ptr_bit (current_gdbarch) == sizeof (CORE_ADDR) * 8) + if (gdbarch_ptr_bit (target_gdbarch) == sizeof (CORE_ADDR) * 8) /* We don't need to truncate anything, and the bit twiddling below will fail due to overflow problems. */ return addr; else - return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_gdbarch)) - 1); + return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch)) - 1); } Elf_Internal_Phdr * diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 1caff52e9d4..5ac6e3849ff 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -481,7 +481,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) else { buf[0] = SDI_WRITE_MEMORY; - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) store_long_parameter (buf + 1, pc_addr); else store_long_parameter (buf + 1, pc_addr - 1); @@ -521,7 +521,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) continue; /* Set PBP. */ - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) send_three_arg_cmd (SDI_WRITE_MEMORY, 0xffff8000 + 4 * i, 4, 0x00000006); else @@ -548,7 +548,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) store_long_parameter (buf + 5, 4); if ((bp_addr & 2) == 0 && bp_addr != (pc_addr & 0xfffffffc)) { - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) { buf[9] = dbt_bp_entry[0]; buf[10] = dbt_bp_entry[1]; @@ -565,7 +565,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) } else { - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) { if ((bp_addr & 2) == 0) { @@ -612,7 +612,7 @@ m32r_resume (ptid_t ptid, int step, enum target_signal sig) continue; /* DBC register */ - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) { switch (ab_type[i]) { @@ -754,7 +754,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) if (last_pc_addr != 0xffffffff) { buf[0] = SDI_WRITE_MEMORY; - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) store_long_parameter (buf + 1, last_pc_addr); else store_long_parameter (buf + 1, last_pc_addr - 1); @@ -783,7 +783,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) address, we have to take care of it later. */ if ((pc_addr & 0x2) != 0) { - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) { if ((bp_data[i][2] & 0x80) != 0) { @@ -845,7 +845,7 @@ m32r_wait (ptid_t ptid, struct target_waitstatus *status) c = serial_readchar (sdi_desc, SDI_TIMEOUT); if (c != '-' && recv_data (buf, 4) != -1) { - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + if (gdbarch_byte_order (target_gdbarch) == BFD_ENDIAN_BIG) { if ((buf[3] & 0x1) == 0x1) hit_watchpoint_addr = ab_address[i]; diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index df17051985a..9b8ca0bf24f 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -1593,10 +1593,10 @@ static void mips_open (char *name, int from_tty) { const char *monitor_prompt = NULL; - if (gdbarch_bfd_arch_info (current_gdbarch) != NULL - && gdbarch_bfd_arch_info (current_gdbarch)->arch == bfd_arch_mips) + if (gdbarch_bfd_arch_info (target_gdbarch) != NULL + && gdbarch_bfd_arch_info (target_gdbarch)->arch == bfd_arch_mips) { - switch (gdbarch_bfd_arch_info (current_gdbarch)->mach) + switch (gdbarch_bfd_arch_info (target_gdbarch)->mach) { case bfd_mach_mips4100: case bfd_mach_mips4300: @@ -2417,7 +2417,7 @@ mips_common_breakpoint (int set, CORE_ADDR addr, int len, enum break_type type) int rpid, rerrflg, rresponse, rlen; int nfields; - addr = gdbarch_addr_bits_remove (current_gdbarch, addr); + addr = gdbarch_addr_bits_remove (target_gdbarch, addr); if (mips_monitor == MON_LSI) { diff --git a/gdb/remote.c b/gdb/remote.c index af3b0b80780..0847d67602e 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -274,9 +274,9 @@ struct packet_reg long regnum; /* GDB's internal register number. */ LONGEST pnum; /* Remote protocol register number. */ int in_g_packet; /* Always part of G packet. */ - /* long size in bytes; == register_size (current_gdbarch, regnum); + /* long size in bytes; == register_size (target_gdbarch, regnum); at present. */ - /* char *name; == gdbarch_register_name (current_gdbarch, regnum); + /* char *name; == gdbarch_register_name (target_gdbarch, regnum); at present. */ }; @@ -309,7 +309,7 @@ static struct gdbarch_data *remote_gdbarch_data_handle; static struct remote_arch_state * get_remote_arch_state (void) { - return gdbarch_data (current_gdbarch, remote_gdbarch_data_handle); + return gdbarch_data (target_gdbarch, remote_gdbarch_data_handle); } /* Fetch the global remote target state. */ @@ -445,7 +445,7 @@ get_remote_packet_size (void) static struct packet_reg * packet_reg_from_regnum (struct remote_arch_state *rsa, long regnum) { - if (regnum < 0 && regnum >= gdbarch_num_regs (current_gdbarch)) + if (regnum < 0 && regnum >= gdbarch_num_regs (target_gdbarch)) return NULL; else { @@ -459,7 +459,7 @@ static struct packet_reg * packet_reg_from_pnum (struct remote_arch_state *rsa, LONGEST pnum) { int i; - for (i = 0; i < gdbarch_num_regs (current_gdbarch); i++) + for (i = 0; i < gdbarch_num_regs (target_gdbarch); i++) { struct packet_reg *r = &rsa->regs[i]; if (r->pnum == pnum) @@ -2400,7 +2400,7 @@ remote_check_symbols (struct objfile *objfile) /* If this is a function address, return the start of code instead of any data function descriptor. */ - sym_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, sym_addr, ¤t_target); @@ -3588,10 +3588,10 @@ Packet: '%s'\n"), phex_nz (pnum, 0), p, buf); fieldsize = hex2bin (p, regs, - register_size (current_gdbarch, + register_size (target_gdbarch, reg->regnum)); p += 2 * fieldsize; - if (fieldsize < register_size (current_gdbarch, + if (fieldsize < register_size (target_gdbarch, reg->regnum)) warning (_("Remote reply is too short: %s"), buf); regcache_raw_supply (get_current_regcache (), @@ -4105,7 +4105,7 @@ remote_address_masked (CORE_ADDR addr) int address_size = remote_address_size; /* If "remoteaddresssize" was not set, default to target address size. */ if (!address_size) - address_size = gdbarch_addr_bit (current_gdbarch); + address_size = gdbarch_addr_bit (target_gdbarch); if (address_size > 0 && address_size < (sizeof (ULONGEST) * 8)) @@ -5373,8 +5373,7 @@ remote_insert_breakpoint (struct bp_target_info *bp_tgt) char *p; int bpsize; - gdbarch_breakpoint_from_pc - (current_gdbarch, &addr, &bpsize); + gdbarch_breakpoint_from_pc (target_gdbarch, &addr, &bpsize); rs = get_remote_state (); p = rs->buf; @@ -5576,7 +5575,7 @@ remote_insert_hw_breakpoint (struct bp_target_info *bp_tgt) instruction, even though we aren't inserting one ourselves. */ gdbarch_breakpoint_from_pc - (current_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); + (target_gdbarch, &bp_tgt->placed_address, &bp_tgt->placed_size); if (remote_protocol_packets[PACKET_Z1].support == PACKET_DISABLE) return -1; @@ -6505,7 +6504,7 @@ static const struct target_desc * remote_read_description (struct target_ops *target) { struct remote_g_packet_data *data - = gdbarch_data (current_gdbarch, remote_g_packet_data_handle); + = gdbarch_data (target_gdbarch, remote_g_packet_data_handle); if (!VEC_empty (remote_g_packet_guess_s, data->guesses)) { diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 463722ab18b..6b6ff15fddc 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -687,7 +687,7 @@ enable_break2 (void) return 0; } - status = frv_fdpic_loadmap_addresses (current_gdbarch, + status = frv_fdpic_loadmap_addresses (target_gdbarch, &interp_loadmap_addr, 0); if (status < 0) { @@ -876,7 +876,7 @@ frv_relocate_main_executable (void) int changed; struct obj_section *osect; - status = frv_fdpic_loadmap_addresses (current_gdbarch, 0, &exec_addr); + status = frv_fdpic_loadmap_addresses (target_gdbarch, 0, &exec_addr); if (status < 0) { diff --git a/gdb/solib-irix.c b/gdb/solib-irix.c index 14f9fc24f65..0e80b94d9b8 100644 --- a/gdb/solib-irix.c +++ b/gdb/solib-irix.c @@ -505,9 +505,9 @@ irix_current_sos (void) read_memory (debug_base, addr_buf, - gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT); + gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT); lma = extract_mips_address (addr_buf, - gdbarch_addr_bit (current_gdbarch) + gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT); while (lma) @@ -611,9 +611,9 @@ irix_open_symbol_file_object (void *from_ttyp) /* First link map member should be the executable. */ read_memory (debug_base, addr_buf, - gdbarch_addr_bit (current_gdbarch) / TARGET_CHAR_BIT); + gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT); lma = extract_mips_address (addr_buf, - gdbarch_addr_bit (current_gdbarch) + gdbarch_addr_bit (target_gdbarch) / TARGET_CHAR_BIT); if (lma == 0) return 0; /* failed somehow... */ diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index 554ffdbeb21..6e5b440fa4c 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -780,9 +780,9 @@ sunos_solib_create_inferior_hook (void) the GDB software break point list. Thus we have to adjust the PC here. */ - if (gdbarch_decr_pc_after_break (current_gdbarch)) + if (gdbarch_decr_pc_after_break (target_gdbarch)) { - stop_pc -= gdbarch_decr_pc_after_break (current_gdbarch); + stop_pc -= gdbarch_decr_pc_after_break (target_gdbarch); write_pc (stop_pc); } diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index f988ae10973..654c90687e9 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -909,7 +909,7 @@ exec_entry_point (struct bfd *abfd, struct target_ops *targ) gdbarch_convert_from_func_ptr_addr(). The method gdbarch_convert_from_func_ptr_addr() is the merely the identify function for targets which don't use function descriptors. */ - return gdbarch_convert_from_func_ptr_addr (current_gdbarch, + return gdbarch_convert_from_func_ptr_addr (target_gdbarch, bfd_get_start_address (abfd), targ); } @@ -987,7 +987,7 @@ enable_break (void) struct obj_section *os; sym_addr = gdbarch_addr_bits_remove - (current_gdbarch, gdbarch_convert_from_func_ptr_addr (current_gdbarch, + (target_gdbarch, gdbarch_convert_from_func_ptr_addr (target_gdbarch, sym_addr, ¤t_target)); @@ -1149,7 +1149,7 @@ enable_break (void) /* Convert 'sym_addr' from a function pointer to an address. Because we pass tmp_bfd_target instead of the current target, this will always produce an unrelocated value. */ - sym_addr = gdbarch_convert_from_func_ptr_addr (current_gdbarch, + sym_addr = gdbarch_convert_from_func_ptr_addr (target_gdbarch, sym_addr, tmp_bfd_target); @@ -1455,12 +1455,12 @@ svr4_free_so (struct so_list *so) static CORE_ADDR svr4_truncate_ptr (CORE_ADDR addr) { - if (gdbarch_ptr_bit (current_gdbarch) == sizeof (CORE_ADDR) * 8) + if (gdbarch_ptr_bit (target_gdbarch) == sizeof (CORE_ADDR) * 8) /* We don't need to truncate anything, and the bit twiddling below will fail due to overflow problems. */ return addr; else - return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (current_gdbarch)) - 1); + return addr & (((CORE_ADDR) 1 << gdbarch_ptr_bit (target_gdbarch)) - 1); } @@ -1518,7 +1518,7 @@ set_solib_svr4_fetch_link_map_offsets (struct gdbarch *gdbarch, static struct link_map_offsets * svr4_fetch_link_map_offsets (void) { - struct solib_svr4_ops *ops = gdbarch_data (current_gdbarch, solib_svr4_data); + struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data); gdb_assert (ops->fetch_link_map_offsets); return ops->fetch_link_map_offsets (); @@ -1529,7 +1529,7 @@ svr4_fetch_link_map_offsets (void) static int svr4_have_link_map_offsets (void) { - struct solib_svr4_ops *ops = gdbarch_data (current_gdbarch, solib_svr4_data); + struct solib_svr4_ops *ops = gdbarch_data (target_gdbarch, solib_svr4_data); return (ops->fetch_link_map_offsets != NULL); } diff --git a/gdb/solib.c b/gdb/solib.c index 515402e6755..1812eada138 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -142,7 +142,7 @@ The search path for loading non-absolute shared library symbol files is %s.\n"), int solib_open (char *in_pathname, char **found_pathname) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); int found_file = -1; char *temp_pathname = NULL; char *p = in_pathname; @@ -321,7 +321,7 @@ solib_map_sections (void *arg) for (p = so->sections; p < so->sections_end; p++) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); /* Relocate the section binding addresses as recorded in the shared object's file by the base address to which the object was actually @@ -369,7 +369,7 @@ solib_map_sections (void *arg) void free_so (struct so_list *so) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); char *bfd_filename = 0; if (so->sections) @@ -490,7 +490,7 @@ solib_read_symbols (struct so_list *so, int from_tty) static void update_solib_list (int from_tty, struct target_ops *target) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); struct so_list *inferior = ops->current_sos(); struct so_list *gdb, **gdb_link; @@ -705,7 +705,7 @@ solib_add (char *pattern, int from_tty, struct target_ops *target, int readsyms) if (loaded_any_symbols) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); /* Getting new symbols may change our opinion about what is frameless. */ @@ -741,7 +741,7 @@ info_sharedlibrary_command (char *ignore, int from_tty) int addr_width; /* "0x", a little whitespace, and two hex digits per byte of pointers. */ - addr_width = 4 + (gdbarch_ptr_bit (current_gdbarch) / 4); + addr_width = 4 + (gdbarch_ptr_bit (target_gdbarch) / 4); update_solib_list (from_tty, 0); @@ -824,7 +824,7 @@ solib_address (CORE_ADDR address) void clear_solib (void) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); /* This function is expected to handle ELF shared libraries. It is also used on Solaris, which can run either ELF or a.out binaries @@ -880,7 +880,7 @@ clear_solib (void) void solib_create_inferior_hook (void) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); ops->solib_create_inferior_hook(); } @@ -903,7 +903,7 @@ solib_create_inferior_hook (void) int in_solib_dynsym_resolve_code (CORE_ADDR pc) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); return ops->in_dynsym_resolve_code (pc); } @@ -973,7 +973,7 @@ solib_global_lookup (const struct objfile *objfile, const char *linkage_name, const domain_enum domain) { - struct target_so_ops *ops = solib_ops (current_gdbarch); + struct target_so_ops *ops = solib_ops (target_gdbarch); if (ops->lookup_lib_global_symbol != NULL) return ops->lookup_lib_global_symbol (objfile, name, linkage_name, domain); diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c index c77acb6de86..ca5b4fdc23b 100644 --- a/gdb/target-descriptions.c +++ b/gdb/target-descriptions.c @@ -183,7 +183,7 @@ target_find_description (void) /* The current architecture should not have any target description specified. It should have been cleared, e.g. when we disconnected from the previous target. */ - gdb_assert (gdbarch_target_desc (current_gdbarch) == NULL); + gdb_assert (gdbarch_target_desc (target_gdbarch) == NULL); /* First try to fetch an XML description from the user-specified file. */ @@ -216,7 +216,7 @@ target_find_description (void) { struct tdesc_arch_data *data; - data = gdbarch_data (current_gdbarch, tdesc_data); + data = gdbarch_data (target_gdbarch, tdesc_data); if (tdesc_has_registers (current_target_desc) && data->registers == NULL) warning (_("Target-supplied registers are not supported " diff --git a/gdb/target.c b/gdb/target.c index 2aff5a61711..edd804dc50b 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -826,7 +826,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) volatile CORE_ADDR addr = 0; if (target_get_thread_local_address_p () - && gdbarch_fetch_tls_load_module_address_p (current_gdbarch)) + && gdbarch_fetch_tls_load_module_address_p (target_gdbarch)) { ptid_t ptid = inferior_ptid; volatile struct gdb_exception ex; @@ -836,7 +836,7 @@ target_translate_tls_address (struct objfile *objfile, CORE_ADDR offset) CORE_ADDR lm_addr; /* Fetch the load module address for this objfile. */ - lm_addr = gdbarch_fetch_tls_load_module_address (current_gdbarch, + lm_addr = gdbarch_fetch_tls_load_module_address (target_gdbarch, objfile); /* If it's 0, throw the appropriate exception. */ if (lm_addr == 0)