From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28561 invoked by alias); 18 Feb 2008 14:47:40 -0000 Received: (qmail 28539 invoked by uid 22791); 18 Feb 2008 14:47:39 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate6.de.ibm.com (HELO mtagate6.de.ibm.com) (195.212.29.155) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 18 Feb 2008 14:47:15 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate6.de.ibm.com (8.13.8/8.13.8) with ESMTP id m1IElCaV195306 for ; Mon, 18 Feb 2008 14:47:12 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v8.7) with ESMTP id m1IElCYj2060394 for ; Mon, 18 Feb 2008 15:47:12 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m1IElBbu015409 for ; Mon, 18 Feb 2008 14:47:12 GMT Received: from bbkeks.de.ibm.com (dyn-9-152-248-39.boeblingen.de.ibm.com [9.152.248.39]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id m1IElAtD015341 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 18 Feb 2008 14:47:11 GMT Message-ID: <47B999F9.1090608@de.ibm.com> Date: Mon, 18 Feb 2008 14:47:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.9 (X11/20071031) MIME-Version: 1.0 To: Ulrich Weigand CC: GDB Patches Subject: Re: [rfc]: Replace current_gdbarch in hppa References: <200802181436.m1IEah6Z030589@d12av02.megacenter.de.ibm.com> In-Reply-To: <200802181436.m1IEah6Z030589@d12av02.megacenter.de.ibm.com> Content-Type: multipart/mixed; boundary="------------090204000902070705060106" Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-02/txt/msg00291.txt.bz2 This is a multi-part message in MIME format. --------------090204000902070705060106 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1015 Ulrich Weigand schrieb: > Likewise those changes can then go away. > Absolutely, yes! I reworked the patch again. Thank you very much ! Ok ? ChangeLog: * 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. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------090204000902070705060106 Content-Type: text/plain; name="diff-hppa" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-hppa" Content-length: 5240 diff -urpN src/gdb/hppabsd-tdep.c dev/gdb/hppabsd-tdep.c --- src/gdb/hppabsd-tdep.c 2008-01-21 06:48:46.000000000 +0100 +++ dev/gdb/hppabsd-tdep.c 2008-02-18 15:36:27.000000000 +0100 @@ -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; diff -urpN src/gdb/hppa-hpux-tdep.c dev/gdb/hppa-hpux-tdep.c --- src/gdb/hppa-hpux-tdep.c 2008-01-16 12:21:15.000000000 +0100 +++ dev/gdb/hppa-hpux-tdep.c 2008-02-18 15:36:27.000000000 +0100 @@ -741,7 +741,8 @@ hppa_hpux_sigtramp_unwind_sniffer (struc } 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 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 } 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 (COR } 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 gdbarc /* 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 -urpN src/gdb/hppa-linux-nat.c dev/gdb/hppa-linux-nat.c --- src/gdb/hppa-linux-nat.c 2008-01-01 23:53:10.000000000 +0100 +++ dev/gdb/hppa-linux-nat.c 2008-02-18 15:39:32.000000000 +0100 @@ -153,7 +153,7 @@ hppa_linux_register_addr (int regno, COR { 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 -urpN src/gdb/hppa-linux-tdep.c dev/gdb/hppa-linux-tdep.c --- src/gdb/hppa-linux-tdep.c 2008-01-01 23:53:10.000000000 +0100 +++ dev/gdb/hppa-linux-tdep.c 2008-02-18 15:36:27.000000000 +0100 @@ -325,7 +325,7 @@ hppa_linux_sigtramp_unwind_sniffer (stru 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 -urpN src/gdb/hppa-tdep.c dev/gdb/hppa-tdep.c --- src/gdb/hppa-tdep.c 2008-01-11 15:42:52.000000000 +0100 +++ dev/gdb/hppa-tdep.c 2008-02-18 15:36:27.000000000 +0100 @@ -828,7 +828,7 @@ hppa32_push_dummy_call (struct gdbarch * 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 * 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 gdbarc } static CORE_ADDR -hppa_find_global_pointer (struct value *function) +hppa_find_global_pointer (struct gdbarch *gdbarch, struct value *function) { return 0; } diff -urpN src/gdb/hppa-tdep.h dev/gdb/hppa-tdep.h --- src/gdb/hppa-tdep.h 2008-01-01 23:53:10.000000000 +0100 +++ dev/gdb/hppa-tdep.h 2008-02-18 15:36:27.000000000 +0100 @@ -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. --------------090204000902070705060106--