diff options
-rw-r--r-- | gdb/ChangeLog | 38 | ||||
-rw-r--r-- | gdb/gcore.c | 2 | ||||
-rw-r--r-- | gdb/m2-lang.c | 10 | ||||
-rw-r--r-- | gdb/m32c-tdep.c | 2 | ||||
-rw-r--r-- | gdb/m32r-rom.c | 5 | ||||
-rw-r--r-- | gdb/ppc-linux-nat.c | 89 | ||||
-rw-r--r-- | gdb/ppc-linux-tdep.c | 6 | ||||
-rw-r--r-- | gdb/ppc-sysv-tdep.c | 32 | ||||
-rw-r--r-- | gdb/ppcnbsd-nat.c | 5 | ||||
-rw-r--r-- | gdb/ppcnbsd-tdep.c | 5 | ||||
-rw-r--r-- | gdb/ppcobsd-nat.c | 7 | ||||
-rw-r--r-- | gdb/ppcobsd-tdep.c | 4 | ||||
-rw-r--r-- | gdb/procfs.c | 18 | ||||
-rw-r--r-- | gdb/remote-m32r-sdi.c | 8 | ||||
-rw-r--r-- | gdb/remote-sim.c | 35 | ||||
-rw-r--r-- | gdb/rs6000-tdep.c | 4 | ||||
-rw-r--r-- | gdb/shnbsd-nat.c | 8 | ||||
-rw-r--r-- | gdb/trad-frame.c | 3 | ||||
-rw-r--r-- | gdb/user-regs.c | 4 | ||||
-rw-r--r-- | gdb/win32-nat.c | 4 | ||||
-rw-r--r-- | gdb/windows-nat.c | 4 |
21 files changed, 171 insertions, 122 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7e59686..9a4a3bc 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,41 @@ +2007-11-16 Markus Deuling <deuling@de.ibm.com> + + * m32r-rom.c (m32r_supply_register): Use get_regcache_arch to get at + the current architecture by regcache. + * ppcnbsd-nat.c (ppcnbsd_supply_pcb): Likewise. + * ppc-linux-nat.c (fetch_altivec_register, fetch_spe_register) + (fetch_register, supply_vrregset, fetch_ppc_registers) + (store_altivec_register, store_spe_register, store_register) + (fill_vrregset, store_ppc_registers): Likewise. + * ppcobsd-nat.c (ppcobsd_supply_pcb): Likewise. + * win32-nat.c (do_win32_fetch_inferior_registers) + (do_win32_store_inferior_registers): Likewise. + * procfs.c (procfs_fetch_registers, procfs_store_registers): Likewise. + * remote-m32r-sdi.c (m32r_fetch_registers) + (m32r_store_registers): Likewise. + * remote-sim.c (gdbsim_fetch_register, gdbsim_store_register): Likewise. + + * trad-frame.c (trad_frame_alloc_saved_regs): Replace current_gdbarch by + gdbarch. + * user-regs.c (user_reg_map_name_to_regnum): Likewise. + * ppc-sysv-tdep.c (ppc_sysv_abi_push_dummy_call) + (do_ppc_sysv_return_value, ppc64_sysv_abi_push_dummy_call) + (ppc64_sysv_abi_return_value): Likewise. + * m32c-tdep.c (m32c_register_reggroup_p): Likewise. + * m2-lang.c (build_m2_types): Likewise. + * ppc-linux-tdep.c (ppc_linux_sigtramp_cache + * ppcnbsd-tdep.c (ppcnbsd_sigtramp_cache_init): Likewise. + * ppcobsd-tdep.c (ppcobsd_sigtramp_frame_cache): Likewise. + * rs6000-tdep.c (ppc_dwarf2_frame_init_reg): Likewise. + + * m68hc11-tdep.c (m68hc11_frame_unwind_cache): Use get_frame_arch to + get at the current architecture by frame_info. + * gcore.c (derive_stack_segment): Likewise. + + * shnbsd-nat.c (GETREGS_SUPPLIES): Add gdbarch parameter. + (shnbsd_fetch_inferior_registers, shnbsd_store_inferior_registers): Add + gdbarch to GETREGS_SUPPLIES call. + 2007-11-16 Ulrich Weigand <uweigand@de.ibm.com> * elfread.c (ST_REGULAR, ST_DYNAMIC, ST_SYNTHETIC): New defines. diff --git a/gdb/gcore.c b/gdb/gcore.c index 9425f15..ab1d9f0 100644 --- a/gdb/gcore.c +++ b/gdb/gcore.c @@ -184,7 +184,7 @@ derive_stack_segment (bfd_vma *bottom, bfd_vma *top) /* Save frame pointer of TOS frame. */ *top = get_frame_base (fi); /* If current stack pointer is more "inner", use that instead. */ - if (gdbarch_inner_than (current_gdbarch, get_frame_sp (fi), *top)) + if (gdbarch_inner_than (get_frame_arch (fi), get_frame_sp (fi), *top)) *top = get_frame_sp (fi); /* Find prev-most frame. */ diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c index bac3632..42338af 100644 --- a/gdb/m2-lang.c +++ b/gdb/m2-lang.c @@ -568,17 +568,17 @@ build_m2_types (struct gdbarch *gdbarch) /* Modula-2 "pervasive" types. NOTE: these can be redefined!!! */ builtin_m2_type->builtin_int = - init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + init_type (TYPE_CODE_INT, + gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, 0, "INTEGER", (struct objfile *) NULL); builtin_m2_type->builtin_card = init_type (TYPE_CODE_INT, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "CARDINAL", (struct objfile *) NULL); builtin_m2_type->builtin_real = init_type (TYPE_CODE_FLT, - gdbarch_float_bit (current_gdbarch) / TARGET_CHAR_BIT, + gdbarch_float_bit (gdbarch) / TARGET_CHAR_BIT, 0, "REAL", (struct objfile *) NULL); builtin_m2_type->builtin_char = @@ -587,7 +587,7 @@ build_m2_types (struct gdbarch *gdbarch) "CHAR", (struct objfile *) NULL); builtin_m2_type->builtin_bool = init_type (TYPE_CODE_BOOL, - gdbarch_int_bit (current_gdbarch) / TARGET_CHAR_BIT, + gdbarch_int_bit (gdbarch) / TARGET_CHAR_BIT, TYPE_FLAG_UNSIGNED, "BOOLEAN", (struct objfile *) NULL); diff --git a/gdb/m32c-tdep.c b/gdb/m32c-tdep.c index c79f88f..2e837e8 100644 --- a/gdb/m32c-tdep.c +++ b/gdb/m32c-tdep.c @@ -265,7 +265,7 @@ int m32c_register_reggroup_p (struct gdbarch *gdbarch, int regnum, struct reggroup *group) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct m32c_reg *reg = &tdep->regs[regnum]; /* The anonymous raw registers aren't in any groups. */ diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index d1399b4..a0b441f 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -213,6 +213,7 @@ m32r_supply_register (struct regcache *regcache, char *regname, { int regno; int num_regs = sizeof (m32r_regnames) / sizeof (m32r_regnames[0]); + struct gdbarch *gdbarch = get_regcache_arch (regcache); for (regno = 0; regno < num_regs; regno++) if (strncmp (regname, m32r_regnames[regno], regnamelen) == 0) @@ -275,10 +276,10 @@ m32r_supply_register (struct regcache *regcache, char *regname, if (regno == SPI_REGNUM && !stackmode) /* SP == SPI */ monitor_supply_register (regcache, - gdbarch_sp_regnum (current_gdbarch), val); + gdbarch_sp_regnum (gdbarch), val); else if (regno == SPU_REGNUM && stackmode) /* SP == SPU */ monitor_supply_register (regcache, - gdbarch_sp_regnum (current_gdbarch), val); + gdbarch_sp_regnum (gdbarch), val); } } } diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c index 7735fc0..f1758c8 100644 --- a/gdb/ppc-linux-nat.c +++ b/gdb/ppc-linux-nat.c @@ -227,8 +227,9 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno) int ret; int offset = 0; gdb_vrregset_t regs; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); if (ret < 0) @@ -246,7 +247,7 @@ fetch_altivec_register (struct regcache *regcache, int tid, int regno) vector. VRSAVE is at the end of the array in a 4 bytes slot, so there is no need to define an offset for it. */ if (regno == (tdep->ppc_vrsave_regnum - 1)) - offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); + offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); regcache_raw_supply (regcache, regno, regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); @@ -289,15 +290,16 @@ get_spe_registers (int tid, struct gdb_evrregset_t *evrregset) static void fetch_spe_register (struct regcache *regcache, int tid, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdb_evrregset_t evrregs; gdb_assert (sizeof (evrregs.evr[0]) - == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum)); + == register_size (gdbarch, tdep->ppc_ev0_upper_regnum)); gdb_assert (sizeof (evrregs.acc) - == register_size (current_gdbarch, tdep->ppc_acc_regnum)); + == register_size (gdbarch, tdep->ppc_acc_regnum)); gdb_assert (sizeof (evrregs.spefscr) - == register_size (current_gdbarch, tdep->ppc_spefscr_regnum)); + == register_size (gdbarch, tdep->ppc_spefscr_regnum)); get_spe_registers (tid, &evrregs); @@ -327,7 +329,8 @@ fetch_spe_register (struct regcache *regcache, int tid, int regno) static void fetch_register (struct regcache *regcache, int tid, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (regno); int bytes_transferred; @@ -357,7 +360,7 @@ fetch_register (struct regcache *regcache, int tid, int regno) if (regaddr == -1) { - memset (buf, '\0', register_size (current_gdbarch, regno)); /* Supply zeroes */ + memset (buf, '\0', register_size (gdbarch, regno)); /* Supply zeroes */ regcache_raw_supply (regcache, regno, buf); return; } @@ -366,7 +369,7 @@ fetch_register (struct regcache *regcache, int tid, int regno) 32-bit platform, 64-bit floating-point registers will require two transfers. */ for (bytes_transferred = 0; - bytes_transferred < register_size (current_gdbarch, regno); + bytes_transferred < register_size (gdbarch, regno); bytes_transferred += sizeof (long)) { errno = 0; @@ -377,7 +380,7 @@ fetch_register (struct regcache *regcache, int tid, int regno) { char message[128]; sprintf (message, "reading register %s (#%d)", - gdbarch_register_name (current_gdbarch, regno), regno); + gdbarch_register_name (gdbarch, regno), regno); perror_with_name (message); } } @@ -385,34 +388,34 @@ fetch_register (struct regcache *regcache, int tid, int regno) /* Now supply the register. Keep in mind that the regcache's idea of the register's size may not be a multiple of sizeof (long). */ - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) { /* Little-endian values are always found at the left end of the bytes transferred. */ regcache_raw_supply (regcache, regno, buf); } - else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { /* Big-endian values are found at the right end of the bytes transferred. */ - size_t padding = (bytes_transferred - - register_size (current_gdbarch, regno)); + size_t padding = (bytes_transferred - register_size (gdbarch, regno)); regcache_raw_supply (regcache, regno, buf + padding); } else internal_error (__FILE__, __LINE__, _("fetch_register: unexpected byte order: %d"), - gdbarch_byte_order (current_gdbarch)); + gdbarch_byte_order (gdbarch)); } static void supply_vrregset (struct regcache *regcache, gdb_vrregset_t *vrregsetp) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; - int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); - int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); + int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); + int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); for (i = 0; i < num_of_vrregs; i++) { @@ -452,14 +455,15 @@ static void fetch_ppc_registers (struct regcache *regcache, int tid) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); for (i = 0; i < ppc_num_gprs; i++) fetch_register (regcache, tid, tdep->ppc_gp0_regnum + i); if (tdep->ppc_fp0_regnum >= 0) for (i = 0; i < ppc_num_fprs; i++) fetch_register (regcache, tid, tdep->ppc_fp0_regnum + i); - fetch_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch)); + fetch_register (regcache, tid, gdbarch_pc_regnum (gdbarch)); if (tdep->ppc_ps_regnum != -1) fetch_register (regcache, tid, tdep->ppc_ps_regnum); if (tdep->ppc_cr_regnum != -1) @@ -507,8 +511,9 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno) int ret; int offset = 0; gdb_vrregset_t regs; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); - int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); ret = ptrace (PTRACE_GETVRREGS, tid, 0, ®s); if (ret < 0) @@ -524,7 +529,7 @@ store_altivec_register (const struct regcache *regcache, int tid, int regno) /* VSCR is fetched as a 16 bytes quantity, but it is really 4 bytes long on the hardware. */ if (regno == (tdep->ppc_vrsave_regnum - 1)) - offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); + offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); regcache_raw_collect (regcache, regno, regs + (regno - tdep->ppc_vr0_regnum) * vrregsize + offset); @@ -569,15 +574,16 @@ set_spe_registers (int tid, struct gdb_evrregset_t *evrregset) static void store_spe_register (const struct regcache *regcache, int tid, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct gdb_evrregset_t evrregs; gdb_assert (sizeof (evrregs.evr[0]) - == register_size (current_gdbarch, tdep->ppc_ev0_upper_regnum)); + == register_size (gdbarch, tdep->ppc_ev0_upper_regnum)); gdb_assert (sizeof (evrregs.acc) - == register_size (current_gdbarch, tdep->ppc_acc_regnum)); + == register_size (gdbarch, tdep->ppc_acc_regnum)); gdb_assert (sizeof (evrregs.spefscr) - == register_size (current_gdbarch, tdep->ppc_spefscr_regnum)); + == register_size (gdbarch, tdep->ppc_spefscr_regnum)); if (regno == -1) /* Since we're going to write out every register, the code below @@ -623,7 +629,8 @@ store_spe_register (const struct regcache *regcache, int tid, int regno) static void store_register (const struct regcache *regcache, int tid, int regno) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* This isn't really an address. But ptrace thinks of it as one. */ CORE_ADDR regaddr = ppc_register_u_addr (regno); int i; @@ -648,18 +655,16 @@ store_register (const struct regcache *regcache, int tid, int regno) idea of the register's size may not be a multiple of sizeof (long). */ memset (buf, 0, sizeof buf); - bytes_to_transfer = align_up (register_size (current_gdbarch, regno), - sizeof (long)); - if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_LITTLE) + bytes_to_transfer = align_up (register_size (gdbarch, regno), sizeof (long)); + if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE) { /* Little-endian values always sit at the left end of the buffer. */ regcache_raw_collect (regcache, regno, buf); } - else if (gdbarch_byte_order (current_gdbarch) == BFD_ENDIAN_BIG) + else if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG) { /* Big-endian values sit at the right end of the buffer. */ - size_t padding = (bytes_to_transfer - - register_size (current_gdbarch, regno)); + size_t padding = (bytes_to_transfer - register_size (gdbarch, regno)); regcache_raw_collect (regcache, regno, buf + padding); } @@ -681,7 +686,7 @@ store_register (const struct regcache *regcache, int tid, int regno) { char message[128]; sprintf (message, "writing register %s (#%d)", - gdbarch_register_name (current_gdbarch, regno), regno); + gdbarch_register_name (gdbarch, regno), regno); perror_with_name (message); } } @@ -691,10 +696,11 @@ static void fill_vrregset (const struct regcache *regcache, gdb_vrregset_t *vrregsetp) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int num_of_vrregs = tdep->ppc_vrsave_regnum - tdep->ppc_vr0_regnum + 1; - int vrregsize = register_size (current_gdbarch, tdep->ppc_vr0_regnum); - int offset = vrregsize - register_size (current_gdbarch, tdep->ppc_vrsave_regnum); + int vrregsize = register_size (gdbarch, tdep->ppc_vr0_regnum); + int offset = vrregsize - register_size (gdbarch, tdep->ppc_vrsave_regnum); for (i = 0; i < num_of_vrregs; i++) { @@ -736,14 +742,15 @@ static void store_ppc_registers (const struct regcache *regcache, int tid) { int i; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); for (i = 0; i < ppc_num_gprs; i++) store_register (regcache, tid, tdep->ppc_gp0_regnum + i); if (tdep->ppc_fp0_regnum >= 0) for (i = 0; i < ppc_num_fprs; i++) store_register (regcache, tid, tdep->ppc_fp0_regnum + i); - store_register (regcache, tid, gdbarch_pc_regnum (current_gdbarch)); + store_register (regcache, tid, gdbarch_pc_regnum (gdbarch)); if (tdep->ppc_ps_regnum != -1) store_register (regcache, tid, tdep->ppc_ps_regnum); if (tdep->ppc_cr_regnum != -1) diff --git a/gdb/ppc-linux-tdep.c b/gdb/ppc-linux-tdep.c index 95d127e..7803dff 100644 --- a/gdb/ppc-linux-tdep.c +++ b/gdb/ppc-linux-tdep.c @@ -753,7 +753,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame, struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); base = frame_unwind_register_unsigned (next_frame, - gdbarch_sp_regnum (current_gdbarch)); + gdbarch_sp_regnum (gdbarch)); if (bias > 0 && frame_pc_unwind (next_frame) != func) /* See below, some signal trampolines increment the stack as their first instruction, need to compensate for that. */ @@ -773,7 +773,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame, trad_frame_set_reg_addr (this_cache, regnum, gpregs + i * tdep->wordsize); } trad_frame_set_reg_addr (this_cache, - gdbarch_pc_regnum (current_gdbarch), + gdbarch_pc_regnum (gdbarch), gpregs + 32 * tdep->wordsize); trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, gpregs + 35 * tdep->wordsize); @@ -789,7 +789,7 @@ ppc_linux_sigtramp_cache (struct frame_info *next_frame, /* Floating point registers. */ for (i = 0; i < 32; i++) { - int regnum = i + gdbarch_fp0_regnum (current_gdbarch); + int regnum = i + gdbarch_fp0_regnum (gdbarch); trad_frame_set_reg_addr (this_cache, regnum, fpregs + i * tdep->wordsize); } diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c index 9d54227..9238f26 100644 --- a/gdb/ppc-sysv-tdep.c +++ b/gdb/ppc-sysv-tdep.c @@ -48,15 +48,14 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int nargs, struct value **args, CORE_ADDR sp, int struct_return, CORE_ADDR struct_addr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ULONGEST saved_sp; int argspace = 0; /* 0 is an initial wrong guess. */ int write_pass; gdb_assert (tdep->wordsize == 4); - regcache_cooked_read_unsigned (regcache, - gdbarch_sp_regnum (current_gdbarch), + regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch), &saved_sp); /* Go through the argument list twice. @@ -146,7 +145,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, else if (TYPE_CODE (type) == TYPE_CODE_FLT && len == 16 && !tdep->soft_float - && (gdbarch_long_double_format (current_gdbarch) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { /* IBM long double passed in two FP registers if @@ -208,7 +207,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } } else if (len == 16 && TYPE_CODE (type) == TYPE_CODE_FLT - && (gdbarch_long_double_format (current_gdbarch) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { /* Soft-float IBM long double passed in four consecutive @@ -375,8 +374,7 @@ ppc_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } /* Update %sp. */ - regcache_cooked_write_signed (regcache, - gdbarch_sp_regnum (current_gdbarch), sp); + regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp); /* Write the backchain (it occupies WORDSIZED bytes). */ write_memory_signed_integer (sp, tdep->wordsize, saved_sp); @@ -438,8 +436,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type, if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16 && !tdep->soft_float - && (gdbarch_long_double_format (current_gdbarch) - == floatformats_ibm_long_double)) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { /* IBM long double stored in f1 and f2. */ if (readbuf) @@ -458,8 +455,7 @@ do_ppc_sysv_return_value (struct gdbarch *gdbarch, struct type *type, } if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16 - && (gdbarch_long_double_format (current_gdbarch) - == floatformats_ibm_long_double)) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { /* Soft-float IBM long double stored in r3, r4, r5, r6. */ if (readbuf) @@ -736,7 +732,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, int struct_return, CORE_ADDR struct_addr) { CORE_ADDR func_addr = find_function_addr (function, NULL); - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); ULONGEST back_chain; /* See for-loop comment below. */ int write_pass; @@ -763,8 +759,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, /* By this stage in the proceedings, SP has been decremented by "red zone size" + "struct return size". Fetch the stack-pointer from before this and use that as the BACK_CHAIN. */ - regcache_cooked_read_unsigned (regcache, - gdbarch_sp_regnum (current_gdbarch), + regcache_cooked_read_unsigned (regcache, gdbarch_sp_regnum (gdbarch), &back_chain); /* Go through the argument list twice. @@ -878,7 +873,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } else if (TYPE_CODE (type) == TYPE_CODE_FLT && TYPE_LENGTH (type) == 16 - && (gdbarch_long_double_format (current_gdbarch) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { /* IBM long double stored in two doublewords of the @@ -1033,7 +1028,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, freg++; } else if (TYPE_LENGTH (type) == 16 - && (gdbarch_long_double_format (current_gdbarch) + && (gdbarch_long_double_format (gdbarch) == floatformats_ibm_long_double)) { if (write_pass) @@ -1071,8 +1066,7 @@ ppc64_sysv_abi_push_dummy_call (struct gdbarch *gdbarch, struct value *function, } /* Update %sp. */ - regcache_cooked_write_signed (regcache, - gdbarch_sp_regnum (current_gdbarch), sp); + regcache_cooked_write_signed (regcache, gdbarch_sp_regnum (gdbarch), sp); /* Write the backchain (it occupies WORDSIZED bytes). */ write_memory_signed_integer (sp, tdep->wordsize, back_chain); @@ -1231,7 +1225,7 @@ ppc64_sysv_abi_return_value (struct gdbarch *gdbarch, struct type *valtype, { gdb_byte regval[MAX_REGISTER_SIZE]; struct type *regtype = - register_type (current_gdbarch, tdep->ppc_fp0_regnum); + register_type (gdbarch, tdep->ppc_fp0_regnum); if (writebuf != NULL) { convert_typed_floating ((const bfd_byte *) writebuf + diff --git a/gdb/ppcnbsd-nat.c b/gdb/ppcnbsd-nat.c index db6fce1..42d522e 100644 --- a/gdb/ppcnbsd-nat.c +++ b/gdb/ppcnbsd-nat.c @@ -146,7 +146,8 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { struct switchframe sf; struct callframe cf; - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int i; /* The stack pointer shouldn't be zero. */ @@ -167,7 +168,7 @@ ppcnbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) read_memory(cf.sp, (gdb_byte *)&cf, sizeof(cf)); regcache_raw_supply (regcache, tdep->ppc_lr_regnum, &cf.lr); - regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), &cf.lr); + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr); return 1; } diff --git a/gdb/ppcnbsd-tdep.c b/gdb/ppcnbsd-tdep.c index 9921ca0..de774c5 100644 --- a/gdb/ppcnbsd-tdep.c +++ b/gdb/ppcnbsd-tdep.c @@ -114,7 +114,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self, int i; base = frame_unwind_register_unsigned (next_frame, - gdbarch_sp_regnum (current_gdbarch)); + gdbarch_sp_regnum (gdbarch)); if (self == &ppcnbsd2_sigtramp) addr = base + 0x10 + 2 * tdep->wordsize; else @@ -132,8 +132,7 @@ ppcnbsd_sigtramp_cache_init (const struct tramp_frame *self, addr += tdep->wordsize; trad_frame_set_reg_addr (this_cache, tdep->ppc_ctr_regnum, addr); addr += tdep->wordsize; - trad_frame_set_reg_addr (this_cache, - gdbarch_pc_regnum (current_gdbarch), + trad_frame_set_reg_addr (this_cache, gdbarch_pc_regnum (gdbarch), addr); /* SRR0? */ addr += tdep->wordsize; diff --git a/gdb/ppcobsd-nat.c b/gdb/ppcobsd-nat.c index 35269d7..7b30674 100644 --- a/gdb/ppcobsd-nat.c +++ b/gdb/ppcobsd-nat.c @@ -148,7 +148,8 @@ ppcobsd_store_registers (struct regcache *regcache, int regnum) static int ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) { - struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); struct switchframe sf; struct callframe cf; int i, regnum; @@ -167,14 +168,14 @@ ppcobsd_supply_pcb (struct regcache *regcache, struct pcb *pcb) return 0; read_memory (pcb->pcb_sp, (gdb_byte *)&sf, sizeof sf); - regcache_raw_supply (regcache, gdbarch_sp_regnum (current_gdbarch), &sf.sp); + regcache_raw_supply (regcache, gdbarch_sp_regnum (gdbarch), &sf.sp); regcache_raw_supply (regcache, tdep->ppc_cr_regnum, &sf.cr); regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 2, &sf.fixreg2); for (i = 0, regnum = tdep->ppc_gp0_regnum + 13; i < 19; i++, regnum++) regcache_raw_supply (regcache, regnum, &sf.fixreg[i]); read_memory (sf.sp, (gdb_byte *)&cf, sizeof cf); - regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), &cf.lr); + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), &cf.lr); regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 30, &cf.r30); regcache_raw_supply (regcache, tdep->ppc_gp0_regnum + 31, &cf.r31); diff --git a/gdb/ppcobsd-tdep.c b/gdb/ppcobsd-tdep.c index dac9e7b..058dd92 100644 --- a/gdb/ppcobsd-tdep.c +++ b/gdb/ppcobsd-tdep.c @@ -186,7 +186,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) sigcontext_offset = (0x10000 - (insn & 0x0000ffff)) + 8; base = frame_unwind_register_unsigned (next_frame, - gdbarch_sp_regnum (current_gdbarch)); + gdbarch_sp_regnum (gdbarch)); addr = base + sigcontext_offset + 2 * tdep->wordsize; for (i = 0; i < ppc_num_gprs; i++, addr += tdep->wordsize) { @@ -201,7 +201,7 @@ ppcobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache) addr += tdep->wordsize; trad_frame_set_reg_addr (cache, tdep->ppc_ctr_regnum, addr); addr += tdep->wordsize; - trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (current_gdbarch), addr); + trad_frame_set_reg_addr (cache, gdbarch_pc_regnum (gdbarch), addr); /* SRR0? */ addr += tdep->wordsize; diff --git a/gdb/procfs.c b/gdb/procfs.c index af7e34e..e288459 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -3687,6 +3687,7 @@ procfs_fetch_registers (struct regcache *regcache, int regnum) procinfo *pi; int pid = PIDGET (inferior_ptid); int tid = TIDGET (inferior_ptid); + struct gdbarch *gdbarch = get_regcache_arch (regcache); /* First look up procinfo for the main process. */ pi = find_procinfo_or_die (pid, 0); @@ -3707,13 +3708,13 @@ procfs_fetch_registers (struct regcache *regcache, int regnum) supply_gregset (regcache, (const gdb_gregset_t *) gregs); - if (gdbarch_fp0_regnum (current_gdbarch) >= 0) /* Do we have an FPU? */ + if (gdbarch_fp0_regnum (gdbarch) >= 0) /* Do we have an FPU? */ { gdb_fpregset_t *fpregs; - if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch)) - || regnum == gdbarch_pc_regnum (current_gdbarch) - || regnum == gdbarch_sp_regnum (current_gdbarch)) + if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch)) + || regnum == gdbarch_pc_regnum (gdbarch) + || regnum == gdbarch_sp_regnum (gdbarch)) return; /* Not a floating point register. */ fpregs = proc_get_fpregs (pi); @@ -3752,6 +3753,7 @@ procfs_store_registers (struct regcache *regcache, int regnum) procinfo *pi; int pid = PIDGET (inferior_ptid); int tid = TIDGET (inferior_ptid); + struct gdbarch *gdbarch = get_regcache_arch (regcache); /* First find procinfo for main process. */ pi = find_procinfo_or_die (pid, 0); @@ -3774,13 +3776,13 @@ procfs_store_registers (struct regcache *regcache, int regnum) if (!proc_set_gregs (pi)) proc_error (pi, "store_registers, set_gregs", __LINE__); - if (gdbarch_fp0_regnum (current_gdbarch) >= 0) /* Do we have an FPU? */ + if (gdbarch_fp0_regnum (gdbarch) >= 0) /* Do we have an FPU? */ { gdb_fpregset_t *fpregs; - if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (current_gdbarch)) - || regnum == gdbarch_pc_regnum (current_gdbarch) - || regnum == gdbarch_sp_regnum (current_gdbarch)) + if ((regnum >= 0 && regnum < gdbarch_fp0_regnum (gdbarch)) + || regnum == gdbarch_pc_regnum (gdbarch) + || regnum == gdbarch_sp_regnum (gdbarch)) return; /* Not a floating point register. */ fpregs = proc_get_fpregs (pi); diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index dc1e6a0..25d5dc9 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -908,7 +908,9 @@ m32r_fetch_registers (struct regcache *regcache) { int regno; - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; + regno < gdbarch_num_regs (get_regcache_arch (regcache)); + regno++) m32r_fetch_register (regcache, regno); } @@ -957,7 +959,9 @@ m32r_store_registers (struct regcache *regcache) { int regno; - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; + regno < gdbarch_num_regs (get_regcache_arch (regcache)); + regno++) m32r_store_register (regcache, regno); registers_changed (); diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c index fcfb55e..59fc1b8 100644 --- a/gdb/remote-sim.c +++ b/gdb/remote-sim.c @@ -279,14 +279,15 @@ one2one_register_sim_regno (int regnum) static void gdbsim_fetch_register (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regno == -1) { - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) gdbsim_fetch_register (regcache, regno); return; } - switch (gdbarch_register_sim_regno (current_gdbarch, regno)) + switch (gdbarch_register_sim_regno (gdbarch, regno)) { case LEGACY_SIM_REGNO_IGNORE: break; @@ -306,22 +307,23 @@ gdbsim_fetch_register (struct regcache *regcache, int regno) static int warn_user = 1; char buf[MAX_REGISTER_SIZE]; int nr_bytes; - gdb_assert (regno >= 0 && regno < gdbarch_num_regs (current_gdbarch)); + gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch)); memset (buf, 0, MAX_REGISTER_SIZE); nr_bytes = sim_fetch_register (gdbsim_desc, gdbarch_register_sim_regno - (current_gdbarch, regno), + (gdbarch, regno), buf, - register_size (current_gdbarch, regno)); - if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user) + register_size (gdbarch, regno)); + if (nr_bytes > 0 + && nr_bytes != register_size (gdbarch, regno) && warn_user) { fprintf_unfiltered (gdb_stderr, "Size of register %s (%d/%d) incorrect (%d instead of %d))", - gdbarch_register_name (current_gdbarch, regno), + gdbarch_register_name (gdbarch, regno), regno, gdbarch_register_sim_regno - (current_gdbarch, regno), - nr_bytes, register_size (current_gdbarch, regno)); + (gdbarch, regno), + nr_bytes, register_size (gdbarch, regno)); warn_user = 0; } /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' @@ -334,7 +336,7 @@ gdbsim_fetch_register (struct regcache *regcache, int regno) { printf_filtered ("gdbsim_fetch_register: %d", regno); /* FIXME: We could print something more intelligible. */ - dump_mem (buf, register_size (current_gdbarch, regno)); + dump_mem (buf, register_size (gdbarch, regno)); } break; } @@ -345,22 +347,23 @@ gdbsim_fetch_register (struct regcache *regcache, int regno) static void gdbsim_store_register (struct regcache *regcache, int regno) { + struct gdbarch *gdbarch = get_regcache_arch (regcache); if (regno == -1) { - for (regno = 0; regno < gdbarch_num_regs (current_gdbarch); regno++) + for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) gdbsim_store_register (regcache, regno); return; } - else if (gdbarch_register_sim_regno (current_gdbarch, regno) >= 0) + else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0) { char tmp[MAX_REGISTER_SIZE]; int nr_bytes; regcache_cooked_read (regcache, regno, tmp); nr_bytes = sim_store_register (gdbsim_desc, gdbarch_register_sim_regno - (current_gdbarch, regno), - tmp, register_size (current_gdbarch, regno)); - if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno)) + (gdbarch, regno), + tmp, register_size (gdbarch, regno)); + if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno)) internal_error (__FILE__, __LINE__, _("Register size different to expected")); /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0' @@ -370,7 +373,7 @@ gdbsim_store_register (struct regcache *regcache, int regno) { printf_filtered ("gdbsim_store_register: %d", regno); /* FIXME: We could print something more intelligible. */ - dump_mem (tmp, register_size (current_gdbarch, regno)); + dump_mem (tmp, register_size (gdbarch, regno)); } } } diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index 713dfff..198f2c8 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -3145,9 +3145,9 @@ ppc_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum, } /* Handle PC register and Stack Pointer correctly. */ - if (regnum == gdbarch_pc_regnum (current_gdbarch)) + if (regnum == gdbarch_pc_regnum (gdbarch)) reg->how = DWARF2_FRAME_REG_RA; - else if (regnum == gdbarch_sp_regnum (current_gdbarch)) + else if (regnum == gdbarch_sp_regnum (gdbarch)) reg->how = DWARF2_FRAME_REG_CFA; } diff --git a/gdb/shnbsd-nat.c b/gdb/shnbsd-nat.c index 1a52e47..2b0fd44 100644 --- a/gdb/shnbsd-nat.c +++ b/gdb/shnbsd-nat.c @@ -33,16 +33,16 @@ /* Determine if PT_GETREGS fetches this register. */ -#define GETREGS_SUPPLIES(regno) \ +#define GETREGS_SUPPLIES(gdbarch, regno) \ (((regno) >= R0_REGNUM && (regno) <= (R0_REGNUM + 15)) \ -|| (regno) == gdbarch_pc_regnum (current_gdbarch) || (regno) == PR_REGNUM \ +|| (regno) == gdbarch_pc_regnum (gdbarch) || (regno) == PR_REGNUM \ || (regno) == MACH_REGNUM || (regno) == MACL_REGNUM \ || (regno) == SR_REGNUM) static void shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno) { - if (regno == -1 || GETREGS_SUPPLIES (regno)) + if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno)) { struct reg inferior_registers; @@ -60,7 +60,7 @@ shnbsd_fetch_inferior_registers (struct regcache *regcache, int regno) static void shnbsd_store_inferior_registers (struct regcache *regcache, int regno) { - if (regno == -1 || GETREGS_SUPPLIES (regno)) + if (regno == -1 || GETREGS_SUPPLIES (get_regcache_arch (regcache), regno)) { struct reg inferior_registers; diff --git a/gdb/trad-frame.c b/gdb/trad-frame.c index 7c7952d..b330668 100644 --- a/gdb/trad-frame.c +++ b/gdb/trad-frame.c @@ -51,8 +51,7 @@ trad_frame_alloc_saved_regs (struct frame_info *next_frame) { int regnum; struct gdbarch *gdbarch = get_frame_arch (next_frame); - int numregs = gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch); + int numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); struct trad_frame_saved_reg *this_saved_regs = FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg); for (regnum = 0; regnum < numregs; regnum++) diff --git a/gdb/user-regs.c b/gdb/user-regs.c index 2d7c71d..79a2dd1 100644 --- a/gdb/user-regs.c +++ b/gdb/user-regs.c @@ -154,8 +154,8 @@ user_reg_map_name_to_regnum (struct gdbarch *gdbarch, const char *name, if ((len < 0 && strcmp (reg->name, name)) || (len == strlen (reg->name) && strncmp (reg->name, name, len) == 0)) - return gdbarch_num_regs (current_gdbarch) - + gdbarch_num_pseudo_regs (current_gdbarch) + nr; + return gdbarch_num_regs (gdbarch) + + gdbarch_num_pseudo_regs (gdbarch) + nr; } } diff --git a/gdb/win32-nat.c b/gdb/win32-nat.c index cbb696b..6c76719 100644 --- a/gdb/win32-nat.c +++ b/gdb/win32-nat.c @@ -400,7 +400,7 @@ do_win32_fetch_inferior_registers (struct regcache *regcache, int r) regcache_raw_supply (regcache, r, context_offset); else { - for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++) + for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++) do_win32_fetch_inferior_registers (regcache, r); } @@ -427,7 +427,7 @@ do_win32_store_inferior_registers (const struct regcache *regcache, int r) ((char *) ¤t_thread->context) + mappings[r]); else { - for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++) + for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++) do_win32_store_inferior_registers (regcache, r); } } diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c index cbb696b..6c76719 100644 --- a/gdb/windows-nat.c +++ b/gdb/windows-nat.c @@ -400,7 +400,7 @@ do_win32_fetch_inferior_registers (struct regcache *regcache, int r) regcache_raw_supply (regcache, r, context_offset); else { - for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++) + for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++) do_win32_fetch_inferior_registers (regcache, r); } @@ -427,7 +427,7 @@ do_win32_store_inferior_registers (const struct regcache *regcache, int r) ((char *) ¤t_thread->context) + mappings[r]); else { - for (r = 0; r < gdbarch_num_regs (current_gdbarch); r++) + for (r = 0; r < gdbarch_num_regs (get_regcache_arch (regcache)); r++) do_win32_store_inferior_registers (regcache, r); } } |