From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27545 invoked by alias); 25 Apr 2007 22:40:43 -0000 Received: (qmail 27519 invoked by uid 22791); 25 Apr 2007 22:40:43 -0000 X-Spam-Check-By: sourceware.org Received: from mtagate8.de.ibm.com (HELO mtagate8.de.ibm.com) (195.212.29.157) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 25 Apr 2007 23:40:40 +0100 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id l3PMebaR194614 for ; Wed, 25 Apr 2007 22:40:37 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.3) with ESMTP id l3PMebnN4030572 for ; Thu, 26 Apr 2007 00:40:37 +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 l3PMebmK012963 for ; Thu, 26 Apr 2007 00:40:37 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id l3PMebj9012960; Thu, 26 Apr 2007 00:40:37 +0200 Message-Id: <200704252240.l3PMebj9012960@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Thu, 26 Apr 2007 00:40:37 +0200 Subject: Re: [rfc] [4/7] Modernize AIX target: inf-ptrace build fix To: drow@false.org (Daniel Jacobowitz) Date: Thu, 26 Apr 2007 00:15:00 -0000 From: "Ulrich Weigand" Cc: mark.kettenis@xs4all.nl (Mark Kettenis), gdb-patches@sourceware.org In-Reply-To: <20070425012548.GA15117@caradoc.them.org> from "Daniel Jacobowitz" at Apr 24, 2007 09:25:48 PM X-Mailer: ELM [version 2.5 PL2] MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-04/txt/msg00350.txt.bz2 Daniel Jacobowitz wrote: > On Wed, Apr 25, 2007 at 02:26:26AM +0200, Ulrich Weigand wrote: > > Can we assume every system where inf-ptrace.c is built has uintptr_t? > > I notice the type isn't frequently used elsewhere in GDB today. > > You Can Now. Take a look at the generated gdb_stdint.h. Nice! I'll use the following modified patch then. Tested on powerpc-ibm-aix5.3.0.0. Bye, Ulrich ChangeLog: * inf-ptrace.c: Include "gdb_stdint.h". (inf_ptrace_xfer_partial): Use "uintptr_t" instead of "long" as intermediate type when casting CORE_ADDR to PTRACE_TYPE_ARG3. (inf_ptrace_fetch_register): Add intermediate cast to "uintptr_t" before casting CORE_ADDR to PTRACE_TYPE_ARG3. (inf_ptrace_store_register): Likewise. * Makefile.in (inf-ptrace.o): Update dependencies. diff -urNp gdb-orig/gdb/inf-ptrace.c gdb-head/gdb/inf-ptrace.c --- gdb-orig/gdb/inf-ptrace.c 2007-04-14 18:08:02.000000000 +0200 +++ gdb-head/gdb/inf-ptrace.c 2007-04-25 19:22:38.793800264 +0200 @@ -28,6 +28,7 @@ #include "gdbcore.h" #include "regcache.h" +#include "gdb_stdint.h" #include "gdb_assert.h" #include "gdb_string.h" #include "gdb_ptrace.h" @@ -504,7 +505,8 @@ inf_ptrace_xfer_partial (struct target_o < rounded_offset + sizeof (PTRACE_TYPE_RET))) /* Need part of initial word -- fetch it. */ buffer.word = ptrace (PT_READ_I, pid, - (PTRACE_TYPE_ARG3)(long)rounded_offset, 0); + (PTRACE_TYPE_ARG3)(uintptr_t) + rounded_offset, 0); /* Copy data to be written over corresponding part of buffer. */ @@ -513,14 +515,16 @@ inf_ptrace_xfer_partial (struct target_o errno = 0; ptrace (PT_WRITE_D, pid, - (PTRACE_TYPE_ARG3)(long)rounded_offset, buffer.word); + (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, + buffer.word); if (errno) { /* Using the appropriate one (I or D) is necessary for Gould NP1, at least. */ errno = 0; ptrace (PT_WRITE_I, pid, - (PTRACE_TYPE_ARG3)(long)rounded_offset, buffer.word); + (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, + buffer.word); if (errno) return 0; } @@ -530,7 +534,8 @@ inf_ptrace_xfer_partial (struct target_o { errno = 0; buffer.word = ptrace (PT_READ_I, pid, - (PTRACE_TYPE_ARG3)(long)rounded_offset, 0); + (PTRACE_TYPE_ARG3)(uintptr_t)rounded_offset, + 0); if (errno) return 0; /* Copy appropriate bytes out of the buffer. */ @@ -642,7 +647,7 @@ inf_ptrace_fetch_register (int regnum) for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++) { errno = 0; - buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)addr, 0); + buf[i] = ptrace (PT_READ_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, 0); if (errno != 0) error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regnum), regnum, safe_strerror (errno)); @@ -696,7 +701,7 @@ inf_ptrace_store_register (int regnum) for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++) { errno = 0; - ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)addr, buf[i]); + ptrace (PT_WRITE_U, pid, (PTRACE_TYPE_ARG3)(uintptr_t)addr, buf[i]); if (errno != 0) error (_("Couldn't write register %s (#%d): %s."), REGISTER_NAME (regnum), regnum, safe_strerror (errno)); diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in --- gdb-orig/gdb/Makefile.in 2007-04-25 19:30:42.240699372 +0200 +++ gdb-head/gdb/Makefile.in 2007-04-25 19:20:02.585131633 +0200 @@ -2170,7 +2170,7 @@ inflow.o: inflow.c $(defs_h) $(frame_h) $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \ $(inflow_h) $(gdb_select_h) inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \ - $(gdbcore_h) $(regcache_h) $(gdb_assert_h) \ + $(gdbcore_h) $(regcache_h) $(gdb_stdint_h) $(gdb_assert_h) \ $(gdb_string_h) $(gdb_ptrace_h) $(gdb_wait_h) $(inf_child_h) infptrace.o: infptrace.c $(defs_h) $(command_h) $(frame_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(target_h) $(gdb_assert_h) \ -- Dr. Ulrich Weigand GNU Toolchain for Linux on System z and Cell BE Ulrich.Weigand@de.ibm.com