From e38c262f357690271e9fa3a5d94909d17ee80865 Mon Sep 17 00:00:00 2001 From: Markus Deuling Date: Mon, 18 Feb 2008 16:11:21 +0000 Subject: [PATCH] * hppa-tdep.h (find_global_pointer): Add gdbarch as parameter. * hppa-hpux-tdep.c (hppa32_hpux_find_global_pointer): Likewise. Replace current_gdbarch by gdbarch. (hppa64_hpux_find_global_pointer): Likewise. * hppa-tdep.c (hppa_find_global_pointer): Likewise. (hppa32_push_dummy_call, hppa64_push_dummy_call): Update call for find_global_pointer. * hppabsd-tdep.c (hppabsd_find_global_pointer): Add gdbarch as parameter. * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. * hppa-linux-nat.c (hppa_linux_register_addr): Use ARRAY_SIZE instead of gdbarch_num_regs. * hppa-hpux-tdep.c (hppa_hpux_sr_for_addr): Add gdbarch as parameter and replace current_gdbarch by gdbarch. (hppa_hpux_push_dummy_code): Update call for hppa_hpux_sr_for_addr. --- gdb/ChangeLog | 22 ++++++++++++++++++++++ gdb/hppa-hpux-tdep.c | 17 ++++++++++------- gdb/hppa-linux-nat.c | 2 +- gdb/hppa-linux-tdep.c | 2 +- gdb/hppa-tdep.c | 6 +++--- gdb/hppa-tdep.h | 2 +- gdb/hppabsd-tdep.c | 2 +- 7 files changed, 39 insertions(+), 14 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7a4182f637b..e85ffc2dff4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,25 @@ +2008-02-18 Markus Deuling + + * hppa-tdep.h (find_global_pointer): Add gdbarch as parameter. + + * hppa-hpux-tdep.c (hppa32_hpux_find_global_pointer): Likewise. Replace + current_gdbarch by gdbarch. + (hppa64_hpux_find_global_pointer): Likewise. + * hppa-tdep.c (hppa_find_global_pointer): Likewise. + (hppa32_push_dummy_call, hppa64_push_dummy_call): Update call for + find_global_pointer. + + * hppabsd-tdep.c (hppabsd_find_global_pointer): Add gdbarch as + parameter. + * hppa-linux-tdep.c (hppa_linux_find_global_pointer): Likewise. + + * hppa-linux-nat.c (hppa_linux_register_addr): Use ARRAY_SIZE instead + of gdbarch_num_regs. + + * hppa-hpux-tdep.c (hppa_hpux_sr_for_addr): Add gdbarch as parameter and + replace current_gdbarch by gdbarch. + (hppa_hpux_push_dummy_code): Update call for hppa_hpux_sr_for_addr. + 2008-02-18 Markus Deuling * rs6000-nat.c (exec_one_dummy_insn, regmap): Add gdbarch as parameter diff --git a/gdb/hppa-hpux-tdep.c b/gdb/hppa-hpux-tdep.c index e7de80502de..0c469b9597d 100644 --- a/gdb/hppa-hpux-tdep.c +++ b/gdb/hppa-hpux-tdep.c @@ -741,7 +741,8 @@ hppa_hpux_sigtramp_unwind_sniffer (struct frame_info *next_frame) } static CORE_ADDR -hppa32_hpux_find_global_pointer (struct value *function) +hppa32_hpux_find_global_pointer (struct gdbarch *gdbarch, + struct value *function) { CORE_ADDR faddr; @@ -760,11 +761,12 @@ hppa32_hpux_find_global_pointer (struct value *function) return extract_unsigned_integer (buf, sizeof (buf)); } - return gdbarch_tdep (current_gdbarch)->solib_get_got_by_pc (faddr); + return gdbarch_tdep (gdbarch)->solib_get_got_by_pc (faddr); } static CORE_ADDR -hppa64_hpux_find_global_pointer (struct value *function) +hppa64_hpux_find_global_pointer (struct gdbarch *gdbarch, + struct value *function) { CORE_ADDR faddr; char buf[32]; @@ -778,7 +780,7 @@ hppa64_hpux_find_global_pointer (struct value *function) } else { - return gdbarch_tdep (current_gdbarch)->solib_get_got_by_pc (faddr); + return gdbarch_tdep (gdbarch)->solib_get_got_by_pc (faddr); } } @@ -1031,11 +1033,11 @@ hppa_hpux_find_import_stub_for_addr (CORE_ADDR funcaddr) } static int -hppa_hpux_sr_for_addr (CORE_ADDR addr) +hppa_hpux_sr_for_addr (struct gdbarch *gdbarch, CORE_ADDR addr) { int sr; /* The space register to use is encoded in the top 2 bits of the address. */ - sr = addr >> (gdbarch_tdep (current_gdbarch)->bytes_per_address * 8 - 2); + sr = addr >> (gdbarch_tdep (gdbarch)->bytes_per_address * 8 - 2); return sr + 4; } @@ -1112,7 +1114,8 @@ hppa_hpux_push_dummy_code (struct gdbarch *gdbarch, CORE_ADDR sp, /* The simple case is where we call a function in the same space that we are currently in; in that case we don't really need to do anything. */ - if (hppa_hpux_sr_for_addr (pc) == hppa_hpux_sr_for_addr (funcaddr)) + if (hppa_hpux_sr_for_addr (gdbarch, pc) + == hppa_hpux_sr_for_addr (gdbarch, funcaddr)) { /* Intraspace call. */ *bp_addr = hppa_hpux_find_dummy_bpaddr (pc); diff --git a/gdb/hppa-linux-nat.c b/gdb/hppa-linux-nat.c index bcd7b4372f0..a92510b94ae 100644 --- a/gdb/hppa-linux-nat.c +++ b/gdb/hppa-linux-nat.c @@ -153,7 +153,7 @@ hppa_linux_register_addr (int regno, CORE_ADDR blockend) { CORE_ADDR addr; - if ((unsigned) regno >= gdbarch_num_regs (current_gdbarch)) + if ((unsigned) regno >= ARRAY_SIZE (u_offsets)) error (_("Invalid register number %d."), regno); if (u_offsets[regno] == -1) diff --git a/gdb/hppa-linux-tdep.c b/gdb/hppa-linux-tdep.c index 4bfbdc01871..50aaa98dcc8 100644 --- a/gdb/hppa-linux-tdep.c +++ b/gdb/hppa-linux-tdep.c @@ -325,7 +325,7 @@ hppa_linux_sigtramp_unwind_sniffer (struct frame_info *next_frame) d_un.d_ptr value is the global pointer. */ static CORE_ADDR -hppa_linux_find_global_pointer (struct value *function) +hppa_linux_find_global_pointer (struct gdbarch *gdbarch, struct value *function) { struct obj_section *faddr_sect; CORE_ADDR faddr; diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c index e5b09f58d86..35ede18274d 100644 --- a/gdb/hppa-tdep.c +++ b/gdb/hppa-tdep.c @@ -828,7 +828,7 @@ hppa32_push_dummy_call (struct gdbarch *gdbarch, struct value *function, if (struct_return) regcache_cooked_write_unsigned (regcache, 28, struct_addr); - gp = tdep->find_global_pointer (function); + gp = tdep->find_global_pointer (gdbarch, function); if (gp != 0) regcache_cooked_write_unsigned (regcache, 19, gp); @@ -1087,7 +1087,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function, regcache_cooked_write_unsigned (regcache, HPPA_RET0_REGNUM, struct_addr); /* Set up GR27 (%dp) to hold the global pointer (gp). */ - gp = tdep->find_global_pointer (function); + gp = tdep->find_global_pointer (gdbarch, function); if (gp != 0) regcache_cooked_write_unsigned (regcache, HPPA_DP_REGNUM, gp); @@ -2705,7 +2705,7 @@ hppa_pseudo_register_read (struct gdbarch *gdbarch, struct regcache *regcache, } static CORE_ADDR -hppa_find_global_pointer (struct value *function) +hppa_find_global_pointer (struct gdbarch *gdbarch, struct value *function) { return 0; } diff --git a/gdb/hppa-tdep.h b/gdb/hppa-tdep.h index 8a0bc97f8ee..1723770ad90 100644 --- a/gdb/hppa-tdep.h +++ b/gdb/hppa-tdep.h @@ -87,7 +87,7 @@ struct gdbarch_tdep /* Given a function address, try to find the global pointer for the corresponding shared object. */ - CORE_ADDR (*find_global_pointer) (struct value *); + CORE_ADDR (*find_global_pointer) (struct gdbarch *, struct value *); /* For shared libraries, each call goes through a small piece of trampoline code in the ".plt", or equivalent, section. diff --git a/gdb/hppabsd-tdep.c b/gdb/hppabsd-tdep.c index f5a31cf10c7..c1d175b5848 100644 --- a/gdb/hppabsd-tdep.c +++ b/gdb/hppabsd-tdep.c @@ -28,7 +28,7 @@ #include "solib-svr4.h" CORE_ADDR -hppabsd_find_global_pointer (struct value *function) +hppabsd_find_global_pointer (struct gdbarch *gdbarch, struct value *function) { CORE_ADDR faddr = value_as_address (function); struct obj_section *faddr_sec; -- 2.30.2