From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7055 invoked by alias); 3 Aug 2007 12:11:51 -0000 Received: (qmail 6862 invoked by uid 22791); 3 Aug 2007 12:11:38 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.29.152) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 03 Aug 2007 12:11:35 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.8/8.13.8) with ESMTP id l73CBWeb154102 for ; Fri, 3 Aug 2007 12:11:32 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.4) with ESMTP id l73CBWg02322654 for ; Fri, 3 Aug 2007 14:11:32 +0200 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 l73CBTrj019714 for ; Fri, 3 Aug 2007 14:11:29 +0200 Received: from bbkeks.boeblingen.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 l73CBSl7019688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 3 Aug 2007 14:11:29 +0200 Message-ID: <46B31B17.6070204@de.ibm.com> Date: Fri, 03 Aug 2007 12:11:00 -0000 From: Markus Deuling User-Agent: Thunderbird 2.0.0.6 (X11/20070728) MIME-Version: 1.0 To: GDB Patches , Ulrich Weigand Subject: [rfc] [01/12] Get rid of current_gdbarch in aix-thread.c Content-Type: multipart/mixed; boundary="------------080901000604000707010806" 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: 2007-08/txt/msg00037.txt.bz2 This is a multi-part message in MIME format. --------------080901000604000707010806 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Content-length: 492 Hi, this patch gets rid of some of the current_gdbarch's in aix-thread.c Is this ok to commit? ChangeLog: * aix-thread.c (supply_gprs64, supply_fprs, supply_sprs64) (supply_sprs32, fetch_regs_user_thread, fetch_regs_kernel_thread) (fill_gprs64, fill_gprs32, fill_fprs, fill_sprs64, fill_sprs32) (store_regs_user_thread, store_regs_kernel_thread): Use FRAME or REGCACHE to recognize current architecture. -- Markus Deuling GNU Toolchain for Linux on Cell BE deuling@de.ibm.com --------------080901000604000707010806 Content-Type: text/plain; name="diff-aix-thread" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff-aix-thread" Content-length: 9942 diff -urpN src/gdb/aix-thread.c dev/gdb/aix-thread.c --- src/gdb/aix-thread.c 2007-06-19 05:22:04.000000000 +0200 +++ dev/gdb/aix-thread.c 2007-08-03 08:23:16.000000000 +0200 @@ -1026,7 +1026,7 @@ aix_thread_wait (ptid_t ptid, struct tar static void supply_gprs64 (struct regcache *regcache, uint64_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1047,12 +1047,13 @@ supply_reg32 (struct regcache *regcache, static void supply_fprs (struct regcache *regcache, double *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int regno; /* This function should never be called on architectures without floating-point registers. */ - gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); + gdb_assert (ppc_floating_point_unit_p (gdbarch)); for (regno = 0; regno < ppc_num_fprs; regno++) regcache_raw_supply (regcache, regno + tdep->ppc_fp0_regnum, @@ -1085,9 +1086,10 @@ supply_sprs64 (struct regcache *regcache uint64_t lr, uint64_t ctr, uint32_t xer, uint32_t fpscr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), (char *) &iar); regcache_raw_supply (regcache, tdep->ppc_ps_regnum, (char *) &msr); regcache_raw_supply (regcache, tdep->ppc_cr_regnum, (char *) &cr); @@ -1108,9 +1110,10 @@ supply_sprs32 (struct regcache *regcache uint32_t lr, uint32_t ctr, uint32_t xer, uint32_t fpscr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - regcache_raw_supply (regcache, gdbarch_pc_regnum (current_gdbarch), + regcache_raw_supply (regcache, gdbarch_pc_regnum (gdbarch), (char *) &iar); regcache_raw_supply (regcache, tdep->ppc_ps_regnum, (char *) &msr); regcache_raw_supply (regcache, tdep->ppc_cr_regnum, (char *) &cr); @@ -1132,7 +1135,8 @@ supply_sprs32 (struct regcache *regcache static void fetch_regs_user_thread (struct regcache *regcache, pthdb_pthread_t pdtid) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int status, i; pthdb_context_t ctx; @@ -1154,7 +1158,7 @@ fetch_regs_user_thread (struct regcache /* Floating-point registers. */ - if (ppc_floating_point_unit_p (current_gdbarch)) + if (ppc_floating_point_unit_p (gdbarch)) supply_fprs (regcache, ctx.fpr); /* Special registers. */ @@ -1186,7 +1190,8 @@ static void fetch_regs_kernel_thread (struct regcache *regcache, int regno, pthdb_tid_t tid) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); uint64_t gprs64[ppc_num_gprs]; uint32_t gprs32[ppc_num_gprs]; double fprs[ppc_num_fprs]; @@ -1222,7 +1227,7 @@ fetch_regs_kernel_thread (struct regcach /* Floating-point registers. */ - if (ppc_floating_point_unit_p (current_gdbarch) + if (ppc_floating_point_unit_p (gdbarch) && (regno == -1 || (regno >= tdep->ppc_fp0_regnum && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) @@ -1247,7 +1252,7 @@ fetch_regs_kernel_thread (struct regcach } else { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); if (!ptrace32 (PTT_READ_SPRS, tid, (int *) &sprs32, 0, NULL)) memset (&sprs32, 0, sizeof (sprs32)); @@ -1290,7 +1295,7 @@ aix_thread_fetch_registers (struct regca static void fill_gprs64 (const struct regcache *regcache, uint64_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1302,7 +1307,7 @@ fill_gprs64 (const struct regcache *regc static void fill_gprs32 (const struct regcache *regcache, uint32_t *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch_tdep *tdep = gdbarch_tdep (get_regcache_arch (regcache)); int regno; for (regno = 0; regno < ppc_num_gprs; regno++) @@ -1315,12 +1320,13 @@ fill_gprs32 (const struct regcache *regc static void fill_fprs (const struct regcache *regcache, double *vals) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int regno; /* This function should never be called on architectures without floating-point registers. */ - gdb_assert (ppc_floating_point_unit_p (current_gdbarch)); + gdb_assert (ppc_floating_point_unit_p (gdbarch)); for (regno = tdep->ppc_fp0_regnum; regno < tdep->ppc_fp0_regnum + ppc_num_fprs; @@ -1338,7 +1344,8 @@ fill_sprs64 (const struct regcache *regc uint64_t *lr, uint64_t *ctr, uint32_t *xer, uint32_t *fpscr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Verify that the size of the size of the IAR buffer is the same as the raw size of the PC (in the register cache). If @@ -1346,11 +1353,10 @@ fill_sprs64 (const struct regcache *regc there's some other kind of internal error. To be really safe, we should check all of the sizes. */ gdb_assert (sizeof (*iar) == register_size - (current_gdbarch, - gdbarch_pc_regnum (current_gdbarch))); + (gdbarch, gdbarch_pc_regnum (gdbarch))); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch))) - regcache_raw_collect (regcache, gdbarch_pc_regnum (current_gdbarch), iar); + if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) + regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); if (regcache_valid_p (regcache, tdep->ppc_cr_regnum)) @@ -1372,19 +1378,19 @@ fill_sprs32 (const struct regcache *regc uint32_t *lr, uint32_t *ctr, uint32_t *xer, uint32_t *fpscr) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); /* Verify that the size of the size of the IAR buffer is the same as the raw size of the PC (in the register cache). If they're not, then either GDB has been built incorrectly, or there's some other kind of internal error. To be really safe, we should check all of the sizes. */ - gdb_assert (sizeof (*iar) == register_size (current_gdbarch, - gdbarch_pc_regnum - (current_gdbarch))); + gdb_assert (sizeof (*iar) == register_size (gdbarch, + gdbarch_pc_regnum (gdbarch))); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch))) - regcache_raw_collect (regcache, gdbarch_pc_regnum (current_gdbarch), iar); + if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) + regcache_raw_collect (regcache, gdbarch_pc_regnum (gdbarch), iar); if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) regcache_raw_collect (regcache, tdep->ppc_ps_regnum, msr); if (regcache_valid_p (regcache, tdep->ppc_cr_regnum)) @@ -1409,7 +1415,8 @@ fill_sprs32 (const struct regcache *regc static void store_regs_user_thread (const struct regcache *regcache, pthdb_pthread_t pdtid) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int status, i; pthdb_context_t ctx; uint32_t int32; @@ -1447,7 +1454,7 @@ store_regs_user_thread (const struct reg } /* Collect floating-point register values from the regcache. */ - if (ppc_floating_point_unit_p (current_gdbarch)) + if (ppc_floating_point_unit_p (gdbarch)) fill_fprs (regcache, ctx.fpr); /* Special registers (always kept in ctx as 64 bits). */ @@ -1465,7 +1472,7 @@ store_regs_user_thread (const struct reg fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, &tmp_ctr, &tmp_xer, &tmp_fpscr); - if (regcache_valid_p (regcache, gdbarch_pc_regnum (current_gdbarch))) + if (regcache_valid_p (regcache, gdbarch_pc_regnum (gdbarch))) ctx.iar = tmp_iar; if (regcache_valid_p (regcache, tdep->ppc_ps_regnum)) ctx.msr = tmp_msr; @@ -1499,7 +1506,8 @@ static void store_regs_kernel_thread (const struct regcache *regcache, int regno, pthdb_tid_t tid) { - struct gdbarch_tdep *tdep = gdbarch_tdep (current_gdbarch); + struct gdbarch *gdbarch = get_regcache_arch (regcache); + struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); uint64_t gprs64[ppc_num_gprs]; uint32_t gprs32[ppc_num_gprs]; double fprs[ppc_num_fprs]; @@ -1535,7 +1543,7 @@ store_regs_kernel_thread (const struct r /* Floating-point registers. */ - if (ppc_floating_point_unit_p (current_gdbarch) + if (ppc_floating_point_unit_p (gdbarch) && (regno == -1 || (regno >= tdep->ppc_fp0_regnum && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) --------------080901000604000707010806--