From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3727 invoked by alias); 6 Jan 2014 15:57:26 -0000 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 Received: (qmail 3717 invoked by uid 89); 6 Jan 2014 15:57:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 06 Jan 2014 15:57:24 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E17ED11647F; Mon, 6 Jan 2014 10:57:22 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id AtEWBGaTjnEZ; Mon, 6 Jan 2014 10:57:22 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id B0EFC116464; Mon, 6 Jan 2014 10:57:20 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 64E3EE0833; Mon, 6 Jan 2014 19:57:17 +0400 (RET) Date: Mon, 06 Jan 2014 15:57:00 -0000 From: Joel Brobecker To: Yao Qi Cc: gdb-patches@sourceware.org Subject: Re: [PATCH] Cast to uintptr_t when calling ptrace32 on aix Message-ID: <20140106155717.GB3802@adacore.com> References: <1388821701-8011-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1388821701-8011-1-git-send-email-yao@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-01/txt/msg00058.txt.bz2 > The machine I used is gcc111 in gcc compile farm. Didn't run > regression testing. Is it OK? > > gdb: > > 2014-01-04 Yao Qi > > * aix-thread.c (pdc_read_regs): Cast parameter to uintptr_t > first. > (pdc_write_regs): Likewise. > (fetch_regs_kernel_thread): Likewise. > (store_regs_kernel_thread): Likewise. Thank you, Yao. I tested your patch with AdaCore's gdb testsuite, and found no regression. Some of the lines are now exceeding the hard limit (80 characters), and need to be folded. Apart from David's suggestion, which we can look at independently, the patch looks OK to me. > --- > gdb/aix-thread.c | 37 ++++++++++++++++++++++--------------- > 1 files changed, 22 insertions(+), 15 deletions(-) > > diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c > index 79adef0..a6333f9 100644 > --- a/gdb/aix-thread.c > +++ b/gdb/aix-thread.c > @@ -363,7 +363,8 @@ pdc_read_regs (pthdb_user_t user, > } > else > { > - if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL)) > + if (!ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) (uintptr_t) gprs32, > + 0, NULL)) > memset (gprs32, 0, sizeof (gprs32)); > memcpy (context->gpr, gprs32, sizeof(gprs32)); > } > @@ -372,7 +373,7 @@ pdc_read_regs (pthdb_user_t user, > /* Floating-point registers. */ > if (flags & PTHDB_FLAG_FPRS) > { > - if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL)) > + if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) (uintptr_t) fprs, 0, NULL)) > memset (fprs, 0, sizeof (fprs)); > memcpy (context->fpr, fprs, sizeof(fprs)); > } > @@ -389,7 +390,7 @@ pdc_read_regs (pthdb_user_t user, > } > else > { > - if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL)) > + if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) (uintptr_t) &sprs32, 0, NULL)) > memset (&sprs32, 0, sizeof (sprs32)); > memcpy (&context->msr, &sprs32, sizeof(sprs32)); > } > @@ -424,13 +425,13 @@ pdc_write_regs (pthdb_user_t user, > ptrace64aix (PTT_WRITE_GPRS, tid, > (unsigned long) context->gpr, 0, NULL); > else > - ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) context->gpr, 0, NULL); > + ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) (uintptr_t) context->gpr, 0, NULL); > } > > /* Floating-point registers. */ > if (flags & PTHDB_FLAG_FPRS) > { > - ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) context->fpr, 0, NULL); > + ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) (uintptr_t) context->fpr, 0, NULL); > } > > /* Special-purpose registers. */ > @@ -443,7 +444,7 @@ pdc_write_regs (pthdb_user_t user, > } > else > { > - ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) &context->msr, 0, NULL); > + ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) (uintptr_t) &context->msr, 0, NULL); > } > } > return 0; > @@ -1250,7 +1251,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, > } > else > { > - if (!ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) gprs32, 0, NULL)) > + if (!ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) (uintptr_t) gprs32, 0, NULL)) > memset (gprs32, 0, sizeof (gprs32)); > for (i = 0; i < ppc_num_gprs; i++) > supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]); > @@ -1264,7 +1265,7 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, > || (regno >= tdep->ppc_fp0_regnum > && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) > { > - if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL)) > + if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) (uintptr_t) fprs, 0, NULL)) > memset (fprs, 0, sizeof (fprs)); > supply_fprs (regcache, fprs); > } > @@ -1286,7 +1287,8 @@ fetch_regs_kernel_thread (struct regcache *regcache, int regno, > { > struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); > > - if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL)) > + if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) (uintptr_t) &sprs32, > + 0, NULL)) > memset (&sprs32, 0, sizeof (sprs32)); > supply_sprs32 (regcache, sprs32.pt_iar, sprs32.pt_msr, sprs32.pt_cr, > sprs32.pt_lr, sprs32.pt_ctr, sprs32.pt_xer, > @@ -1581,9 +1583,11 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, > else > { > /* Pre-fetch: some regs may not be in the cache. */ > - ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) gprs32, 0, NULL); > + ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) (uintptr_t) gprs32, > + 0, NULL); > fill_gprs32 (regcache, gprs32); > - ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) gprs32, 0, NULL); > + ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) (uintptr_t) gprs32, > + 0, NULL); > } > } > > @@ -1595,9 +1599,10 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, > && regno < tdep->ppc_fp0_regnum + ppc_num_fprs))) > { > /* Pre-fetch: some regs may not be in the cache. */ > - ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL); > + ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) (uintptr_t) fprs, > + 0, NULL); > fill_fprs (regcache, fprs); > - ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) fprs, 0, NULL); > + ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) (uintptr_t) fprs, 0, NULL); > } > > /* Special-purpose registers. */ > @@ -1629,7 +1634,8 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, > gdb_assert (sizeof (sprs32.pt_iar) == 4); > > /* Pre-fetch: some registers won't be in the cache. */ > - ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL); > + ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) (uintptr_t) &sprs32, > + 0, NULL); > > fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr, > &tmp_ctr, &tmp_xer, &tmp_fpscr); > @@ -1648,7 +1654,8 @@ store_regs_kernel_thread (const struct regcache *regcache, int regno, > regcache_raw_collect (regcache, tdep->ppc_mq_regnum, > &sprs32.pt_mq); > > - ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) &sprs32, 0, NULL); > + ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) (uintptr_t) &sprs32, > + 0, NULL); > } > } > } > -- > 1.7.7.6 -- Joel