From 24568a2cd9b1422f582b6f9c004ebd67ffadcb90 Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Fri, 5 Sep 2008 11:42:32 +0000 Subject: [PATCH] * gdbarch.sh (addr_bits_remove): Change type to 'm'. (smash_text_address): Likewise. * gdbarch.c, gdbarch.h: Regenerate. * arch-utils.c (core_addr_identity): Add gdbarch parameter. * arch-utils.h (core_addr_identity): Likewise. * arm-tdep.c (arm_addr_bits_remove): Likewise. (arm_smash_text_address): Likewise. * hppa-tdep.c (hppa_smash_text_address): Likewise. * m88k-tdep.c (m88k_addr_bits_remove): Likewise. * s390-tdep.c (s390_addr_bits_remove): Likewise. * mips-tdep.c (mips_addr_bits_remove): Add gdbarch parameter. Use it instead of current_gdbarch. * arm-tdep.c (arm_prologue_prev_register, arm_unwind_pc, arm_dwarf2_prev_register): Update calls. * m88k-tdep.c (m88k_unwind_pc): Update call. --- gdb/ChangeLog | 21 +++++++++++++++++++++ gdb/arch-utils.c | 2 +- gdb/arch-utils.h | 2 +- gdb/arm-tdep.c | 12 +++++++----- gdb/gdbarch.c | 8 ++++---- gdb/gdbarch.h | 4 ++-- gdb/gdbarch.sh | 4 ++-- gdb/hppa-tdep.c | 2 +- gdb/m88k-tdep.c | 4 ++-- gdb/mips-tdep.c | 4 ++-- gdb/s390-tdep.c | 2 +- 11 files changed, 44 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ef10bbdfd63..a2ee6442d27 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,24 @@ +2008-09-05 Ulrich Weigand + + * gdbarch.sh (addr_bits_remove): Change type to 'm'. + (smash_text_address): Likewise. + * gdbarch.c, gdbarch.h: Regenerate. + + * arch-utils.c (core_addr_identity): Add gdbarch parameter. + * arch-utils.h (core_addr_identity): Likewise. + * arm-tdep.c (arm_addr_bits_remove): Likewise. + (arm_smash_text_address): Likewise. + * hppa-tdep.c (hppa_smash_text_address): Likewise. + * m88k-tdep.c (m88k_addr_bits_remove): Likewise. + * s390-tdep.c (s390_addr_bits_remove): Likewise. + + * mips-tdep.c (mips_addr_bits_remove): Add gdbarch parameter. + Use it instead of current_gdbarch. + + * arm-tdep.c (arm_prologue_prev_register, arm_unwind_pc, + arm_dwarf2_prev_register): Update calls. + * m88k-tdep.c (m88k_unwind_pc): Update call. + 2008-09-05 Ulrich Weigand * dwarf2expr.h (dwarf2_read_address): Add gdbarch argument. diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c index 13aee27d64c..3014558e031 100644 --- a/gdb/arch-utils.c +++ b/gdb/arch-utils.c @@ -146,7 +146,7 @@ core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs) /* Misc helper functions for targets. */ CORE_ADDR -core_addr_identity (CORE_ADDR addr) +core_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr) { return addr; } diff --git a/gdb/arch-utils.h b/gdb/arch-utils.h index 6b7a073c8cc..42306597ec8 100644 --- a/gdb/arch-utils.h +++ b/gdb/arch-utils.h @@ -60,7 +60,7 @@ extern int core_addr_greaterthan (CORE_ADDR lhs, CORE_ADDR rhs); /* Identity functions on a CORE_ADDR. Just return the "addr". */ -extern CORE_ADDR core_addr_identity (CORE_ADDR addr); +extern CORE_ADDR core_addr_identity (struct gdbarch *gdbarch, CORE_ADDR addr); extern gdbarch_convert_from_func_ptr_addr_ftype convert_from_func_ptr_addr_identity; /* No-op conversion of reg to regnum. */ diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c index 8c05a5ce0be..cb0eb129389 100644 --- a/gdb/arm-tdep.c +++ b/gdb/arm-tdep.c @@ -363,7 +363,7 @@ arm_pc_is_thumb (CORE_ADDR memaddr) /* Remove useless bits from addresses in a running program. */ static CORE_ADDR -arm_addr_bits_remove (CORE_ADDR val) +arm_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR val) { if (arm_apcs_32) return UNMAKE_THUMB_ADDR (val); @@ -374,7 +374,7 @@ arm_addr_bits_remove (CORE_ADDR val) /* When reading symbols, we need to zap the low bit of the address, which may be set to 1 for Thumb functions. */ static CORE_ADDR -arm_smash_text_address (CORE_ADDR val) +arm_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR val) { return val & ~1; } @@ -1096,6 +1096,7 @@ arm_prologue_prev_register (struct frame_info *this_frame, void **this_cache, int prev_regnum) { + struct gdbarch *gdbarch = get_frame_arch (this_frame); struct arm_prologue_cache *cache; if (*this_cache == NULL) @@ -1113,7 +1114,7 @@ arm_prologue_prev_register (struct frame_info *this_frame, lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM); return frame_unwind_got_constant (this_frame, prev_regnum, - arm_addr_bits_remove (lr)); + arm_addr_bits_remove (gdbarch, lr)); } /* SP is generally not saved to the stack, but this frame is @@ -1251,7 +1252,7 @@ arm_unwind_pc (struct gdbarch *gdbarch, struct frame_info *this_frame) { CORE_ADDR pc; pc = frame_unwind_register_unsigned (this_frame, ARM_PC_REGNUM); - return arm_addr_bits_remove (pc); + return arm_addr_bits_remove (gdbarch, pc); } static CORE_ADDR @@ -1264,6 +1265,7 @@ static struct value * arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache, int regnum) { + struct gdbarch * gdbarch = get_frame_arch (this_frame); CORE_ADDR lr, cpsr; switch (regnum) @@ -1275,7 +1277,7 @@ arm_dwarf2_prev_register (struct frame_info *this_frame, void **this_cache, part of the PC. */ lr = frame_unwind_register_unsigned (this_frame, ARM_LR_REGNUM); return frame_unwind_got_constant (this_frame, regnum, - arm_addr_bits_remove (lr)); + arm_addr_bits_remove (gdbarch, lr)); case ARM_PS_REGNUM: /* Reconstruct the T bit; see arm_prologue_prev_register for details. */ diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index c41d1ce3f21..1986e258050 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -335,8 +335,8 @@ struct gdbarch startup_gdbarch = default_stabs_argument_has_addr, /* stabs_argument_has_addr */ 0, /* frame_red_zone_size */ convert_from_func_ptr_addr_identity, /* convert_from_func_ptr_addr */ - 0, /* addr_bits_remove */ - 0, /* smash_text_address */ + core_addr_identity, /* addr_bits_remove */ + core_addr_identity, /* smash_text_address */ 0, /* software_single_step */ 0, /* single_step_through_delay */ 0, /* print_insn */ @@ -2509,7 +2509,7 @@ gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) gdb_assert (gdbarch->addr_bits_remove != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_addr_bits_remove called\n"); - return gdbarch->addr_bits_remove (addr); + return gdbarch->addr_bits_remove (gdbarch, addr); } void @@ -2526,7 +2526,7 @@ gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr) gdb_assert (gdbarch->smash_text_address != NULL); if (gdbarch_debug >= 2) fprintf_unfiltered (gdb_stdlog, "gdbarch_smash_text_address called\n"); - return gdbarch->smash_text_address (addr); + return gdbarch->smash_text_address (gdbarch, addr); } void diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 0a81e27e8b0..aeafd4ab724 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -491,14 +491,14 @@ extern void set_gdbarch_convert_from_func_ptr_addr (struct gdbarch *gdbarch, gdb sort of generic thing to handle alignment or segmentation (it's possible it should be in TARGET_READ_PC instead). */ -typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (CORE_ADDR addr); +typedef CORE_ADDR (gdbarch_addr_bits_remove_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); extern CORE_ADDR gdbarch_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr); extern void set_gdbarch_addr_bits_remove (struct gdbarch *gdbarch, gdbarch_addr_bits_remove_ftype *addr_bits_remove); /* It is not at all clear why gdbarch_smash_text_address is not folded into gdbarch_addr_bits_remove. */ -typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (CORE_ADDR addr); +typedef CORE_ADDR (gdbarch_smash_text_address_ftype) (struct gdbarch *gdbarch, CORE_ADDR addr); extern CORE_ADDR gdbarch_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr); extern void set_gdbarch_smash_text_address (struct gdbarch *gdbarch, gdbarch_smash_text_address_ftype *smash_text_address); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 82f68f03dc5..a497d114c11 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -529,10 +529,10 @@ m:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr, struct target_ops *targ:a # being a few stray bits in the PC which would mislead us, not as some # sort of generic thing to handle alignment or segmentation (it's # possible it should be in TARGET_READ_PC instead). -f:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 +m:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr::core_addr_identity::0 # It is not at all clear why gdbarch_smash_text_address is not folded into # gdbarch_addr_bits_remove. -f:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0 +m:CORE_ADDR:smash_text_address:CORE_ADDR addr:addr::core_addr_identity::0 # FIXME/cagney/2001-01-18: This should be split in two. A target method that # indicates if the target needs software single step. An ISA method to diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index 11ef0934d79..3b4d331e44a 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -2663,7 +2663,7 @@ hppa64_cannot_fetch_register (struct gdbarch *gdbarch, int regnum) } static CORE_ADDR -hppa_smash_text_address (CORE_ADDR addr) +hppa_smash_text_address (struct gdbarch *gdbarch, CORE_ADDR addr) { /* The low two bits of the PC on the PA contain the privilege level. Some genius implementing a (non-GCC) compiler apparently decided diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c index 9169faa5683..dc9b2919df2 100644 --- a/gdb/m88k-tdep.c +++ b/gdb/m88k-tdep.c @@ -86,7 +86,7 @@ m88k_register_type (struct gdbarch *gdbarch, int regnum) static CORE_ADDR -m88k_addr_bits_remove (CORE_ADDR addr) +m88k_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) { /* All instructures are 4-byte aligned. The lower 2 bits of SXIP, SNIP and SFIP are used for special purposes: bit 0 is the @@ -116,7 +116,7 @@ m88k_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame) CORE_ADDR pc; pc = frame_unwind_register_unsigned (next_frame, M88K_SXIP_REGNUM); - return m88k_addr_bits_remove (pc); + return m88k_addr_bits_remove (gdbarch, pc); } static void diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index b6755421ee9..4d908431edb 100644 --- a/gdb/mips-tdep.c +++ b/gdb/mips-tdep.c @@ -2313,9 +2313,9 @@ mips_stub_frame_base_sniffer (struct frame_info *this_frame) /* mips_addr_bits_remove - remove useless address bits */ static CORE_ADDR -mips_addr_bits_remove (CORE_ADDR addr) +mips_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (mips_mask_address_p (tdep) && (((ULONGEST) addr) >> 32 == 0xffffffffUL)) /* This hack is a work-around for existing boards using PMON, the simulator, and any other 64-bit targets that doesn't have true diff --git a/gdb/s390-tdep.c b/gdb/s390-tdep.c index ae7f332846e..07c1b33ea6d 100644 --- a/gdb/s390-tdep.c +++ b/gdb/s390-tdep.c @@ -2269,7 +2269,7 @@ s390_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr) /* Address handling. */ static CORE_ADDR -s390_addr_bits_remove (CORE_ADDR addr) +s390_addr_bits_remove (struct gdbarch *gdbarch, CORE_ADDR addr) { return addr & 0x7fffffff; } -- 2.30.2