This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] [4/7] Modernize AIX target: inf-ptrace build fix
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 24 Apr 2007 23:37:24 +0200 (CEST)
- Subject: [rfc] [4/7] Modernize AIX target: inf-ptrace build fix
Hello,
this is another small build fix that is a pre-requisite for the
next patch (which adds inf-ptrace.c on AIX). The problem is that
on AIX, PTRACE_TYPE_ARG3 is a pointer, and trying to cast a
CORE_ADDR directly to it gives a compile warning.
The patch adds an intermediate cast to "long" to fix this problem;
there is precedent for this method in inf_ptrace_xfer_partial.
Tested on powerpc-aix-ibm5.3.0.0.
Bye,
Ulrich
ChangeLog:
* inf-ptrace.c (inf_ptrace_fetch_register): Add intermediate cast
to "long" before casting CORE_ADDR to PTRACE_TYPE_ARG3.
(inf_ptrace_store_register): Likewise.
diff -urNp gdb-orig/gdb/inf-ptrace.c gdb-head/gdb/inf-ptrace.c
--- gdb-orig/gdb/inf-ptrace.c Wed Apr 18 16:17:19 2007
+++ gdb-head/gdb/inf-ptrace.c Mon Apr 23 21:14:20 2007
@@ -642,7 +642,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)(long)addr, 0);
if (errno != 0)
error (_("Couldn't read register %s (#%d): %s."),
REGISTER_NAME (regnum), regnum, safe_strerror (errno));
@@ -696,7 +696,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)(long)addr, buf[i]);
if (errno != 0)
error (_("Couldn't write register %s (#%d): %s."),
REGISTER_NAME (regnum), regnum, safe_strerror (errno));
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com