This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[committed] Remove PTRACE_ARG3_TYPE and PTRACE_XFER_TYPE
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 30 Mar 2007 03:20:13 +0200 (CEST)
- Subject: [committed] Remove PTRACE_ARG3_TYPE and PTRACE_XFER_TYPE
Hello,
this is another minor cleanup: removal of the remaining uses of
PTRACE_ARG3_TYPE and PTRACE_XFER_TYPE.
There were two remaining uses of PTRACE_ARG3_TYPE: as argument of
the call_ptrace function, and in calls to ptrace in m68klinux-nat.c.
In both places, none of the remaining non-default definitions is
visible, so the default definition in inferior.h applied. The
patch replaces those uses of PTRACE_ARG3_TYPE with that default
PTRACE_TYPE_ARG3, and removes all definitions.
There was a single remaining use of PTRACE_XFER_TYPE: in the
fetch_registers and store_registers functions in m68klinux-nat.c.
None of the remaining non-default definitions is visible there.
The patch replaces the use with PTRACE_TYPE_RET, and removes all
definitions.
Tested on powerpc64-linux, and by verifying m68klinux-nat.c still
compiles. Committed to mainline.
Bye,
Ulrich
gdb/ChangeLog:
* config/alpha/nm-osf.h (PTRACE_XFER_TYPE): Remove.
* config/mips/nm-linux.h (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Remove.
* config/sparc/nm-linux.h (PTRACE_ARG3_TYPE, PTRACE_XFER_TYPE): Remove.
* config/powerpc/nm-ppc64-linux.h: Remove file.
* config/powerpc/ppc64-linux.mh (NATDEPFILES): Set to nm-linux.h.
* inferior.h (PTRACE_ARG3_TYPE): Do not define.
(call_ptrace): Change type of third argument to PTRACE_TYPE_ARG3.
* infptrace.c (call_ptrace): Likewise.
* m68klinux-nat.c (PTRACE_XFER_TYPE): Do not define.
(fetch_register): Replace PTRACE_ARG3_TYPE by PTRACE_TYPE_ARG3
and PTRACE_XFER_TYPE by PTRACE_TYPE_RET.
(store_register): Likewise.
gdb/doc/ChangeLog:
* gdbint.texi (Native Conditionals): Remove PTRACE_ARG3_TYPE.
diff -urNp gdb-orig/gdb/config/alpha/nm-osf.h gdb-head/gdb/config/alpha/nm-osf.h
--- gdb-orig/gdb/config/alpha/nm-osf.h 2007-01-11 20:58:02.000000000 +0100
+++ gdb-head/gdb/config/alpha/nm-osf.h 2007-03-30 01:13:36.208051632 +0200
@@ -29,10 +29,6 @@
#define U_REGS_OFFSET 0
-/* ptrace transfers longs, the ptrace man page is lying. */
-
-#define PTRACE_XFER_TYPE long
-
/* Given a pointer to either a gregset_t or fpregset_t, return a
pointer to the first register. */
#define ALPHA_REGSET_BASE(regsetp) ((regsetp)->regs)
diff -urNp gdb-orig/gdb/config/mips/nm-linux.h gdb-head/gdb/config/mips/nm-linux.h
--- gdb-orig/gdb/config/mips/nm-linux.h 2007-03-29 04:25:25.000000000 +0200
+++ gdb-head/gdb/config/mips/nm-linux.h 2007-03-30 01:13:15.332029592 +0200
@@ -33,11 +33,6 @@
#define U_REGS_OFFSET 0
-/* ptrace transfers longs, and expects addresses as longs. */
-
-#define PTRACE_ARG3_TYPE long
-#define PTRACE_XFER_TYPE long
-
#define REGISTER_U_ADDR(addr, blockend, regno) \
(addr) = mips_register_addr ((regno),(blockend))
diff -urNp gdb-orig/gdb/config/powerpc/nm-ppc64-linux.h gdb-head/gdb/config/powerpc/nm-ppc64-linux.h
--- gdb-orig/gdb/config/powerpc/nm-ppc64-linux.h 2007-01-11 20:58:03.000000000 +0100
+++ gdb-head/gdb/config/powerpc/nm-ppc64-linux.h 1970-01-01 01:00:00.000000000 +0100
@@ -1,27 +0,0 @@
-/* IBM PowerPC64 native-dependent macros for GDB, the GNU debugger.
- Copyright 2003, 2007 Free Software Foundation, Inc.
-
-This file is part of GDB.
-
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-#ifndef NM_PPC64_LINUX_H
-
-#include "config/powerpc/nm-linux.h"
-
-#define PTRACE_ARG3_TYPE void *
-#define PTRACE_XFER_TYPE long
-
-#endif /* NM_PPC64_LINUX_H */
diff -urNp gdb-orig/gdb/config/powerpc/ppc64-linux.mh gdb-head/gdb/config/powerpc/ppc64-linux.mh
--- gdb-orig/gdb/config/powerpc/ppc64-linux.mh 2006-01-04 20:33:12.000000000 +0100
+++ gdb-head/gdb/config/powerpc/ppc64-linux.mh 2007-03-30 01:14:36.984132864 +0200
@@ -2,7 +2,7 @@
XM_CLIBS=
-NAT_FILE= nm-ppc64-linux.h
+NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o \
ppc-linux-nat.o proc-service.o linux-thread-db.o \
gcore.o linux-nat.o linux-fork.o
diff -urNp gdb-orig/gdb/config/sparc/nm-linux.h gdb-head/gdb/config/sparc/nm-linux.h
--- gdb-orig/gdb/config/sparc/nm-linux.h 2007-01-11 20:58:03.000000000 +0100
+++ gdb-head/gdb/config/sparc/nm-linux.h 2007-03-30 01:13:49.935098408 +0200
@@ -25,12 +25,6 @@
#include "config/nm-linux.h"
-/* Type of the third argument to the `ptrace' system call. */
-#define PTRACE_ARG3_TYPE long
-
-/* Type of the fourth argument to the `ptrace' system call. */
-#define PTRACE_XFER_TYPE long
-
/* Override copies of {fetch,store}_inferior_registers in `infptrace.c'. */
#define FETCH_INFERIOR_REGISTERS
diff -urNp gdb-orig/gdb/doc/gdbint.texinfo gdb-head/gdb/doc/gdbint.texinfo
--- gdb-orig/gdb/doc/gdbint.texinfo 2007-03-27 20:52:34.000000000 +0200
+++ gdb-head/gdb/doc/gdbint.texinfo 2007-03-30 01:10:14.567078448 +0200
@@ -4948,11 +4948,6 @@ Defines the format for the name of a @fi
defined in @file{nm.h} @emph{only} in order to override the default
definition in @file{procfs.c}.
-@item PTRACE_ARG3_TYPE
-@findex PTRACE_ARG3_TYPE
-The type of the third argument to the @code{ptrace} system call, if it
-exists and is different from @code{int}.
-
@item REGISTER_U_ADDR
@findex REGISTER_U_ADDR
Defines the offset of the registers in the ``u area''.
diff -urNp gdb-orig/gdb/inferior.h gdb-head/gdb/inferior.h
--- gdb-orig/gdb/inferior.h 2007-01-11 20:57:53.000000000 +0100
+++ gdb-head/gdb/inferior.h 2007-03-30 01:09:20.998100728 +0200
@@ -236,11 +236,7 @@ int ptrace_wait (ptid_t, int *);
extern void child_resume (ptid_t, int, enum target_signal);
-#ifndef PTRACE_ARG3_TYPE
-#define PTRACE_ARG3_TYPE PTRACE_TYPE_ARG3
-#endif
-
-extern int call_ptrace (int, int, PTRACE_ARG3_TYPE, int);
+extern int call_ptrace (int, int, PTRACE_TYPE_ARG3, int);
extern void pre_fork_inferior (void);
diff -urNp gdb-orig/gdb/infptrace.c gdb-head/gdb/infptrace.c
--- gdb-orig/gdb/infptrace.c 2007-01-11 20:57:53.000000000 +0100
+++ gdb-head/gdb/infptrace.c 2007-03-30 01:09:07.657130280 +0200
@@ -54,7 +54,7 @@ void _initialize_infptrace (void);
int
-call_ptrace (int request, int pid, PTRACE_ARG3_TYPE addr, int data)
+call_ptrace (int request, int pid, PTRACE_TYPE_ARG3 addr, int data)
{
return ptrace (request, pid, addr, data);
}
diff -urNp gdb-orig/gdb/m68klinux-nat.c gdb-head/gdb/m68klinux-nat.c
--- gdb-orig/gdb/m68klinux-nat.c 2007-03-29 04:25:22.000000000 +0200
+++ gdb-head/gdb/m68klinux-nat.c 2007-03-30 01:12:47.049068352 +0200
@@ -118,11 +118,6 @@ m68k_linux_register_u_addr (int blockend
#define PT_WRITE_U PTRACE_POKEUSR
#endif
-/* Default the type of the ptrace transfer to int. */
-#ifndef PTRACE_XFER_TYPE
-#define PTRACE_XFER_TYPE int
-#endif
-
/* Fetch one register. */
static void
@@ -152,12 +147,12 @@ fetch_register (int regno)
regaddr = register_addr (regno, offset);
for (i = 0; i < register_size (current_gdbarch, regno);
- i += sizeof (PTRACE_XFER_TYPE))
+ i += sizeof (PTRACE_TYPE_RET))
{
errno = 0;
- *(PTRACE_XFER_TYPE *) &buf[i] = ptrace (PT_READ_U, tid,
- (PTRACE_ARG3_TYPE) regaddr, 0);
- regaddr += sizeof (PTRACE_XFER_TYPE);
+ *(PTRACE_TYPE_RET *) &buf[i] = ptrace (PT_READ_U, tid,
+ (PTRACE_TYPE_ARG3) regaddr, 0);
+ regaddr += sizeof (PTRACE_TYPE_RET);
if (errno != 0)
{
sprintf (mess, "reading register %s (#%d)",
@@ -220,12 +215,12 @@ store_register (int regno)
/* Store the local buffer into the inferior a chunk at the time. */
for (i = 0; i < register_size (current_gdbarch, regno);
- i += sizeof (PTRACE_XFER_TYPE))
+ i += sizeof (PTRACE_TYPE_RET))
{
errno = 0;
- ptrace (PT_WRITE_U, tid, (PTRACE_ARG3_TYPE) regaddr,
- *(PTRACE_XFER_TYPE *) (buf + i));
- regaddr += sizeof (PTRACE_XFER_TYPE);
+ ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) regaddr,
+ *(PTRACE_TYPE_RET *) (buf + i));
+ regaddr += sizeof (PTRACE_TYPE_RET);
if (errno != 0)
{
sprintf (mess, "writing register %s (#%d)",
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com