aboutsummaryrefslogtreecommitdiff
path: root/gdb/infptrace.c
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1992-06-24 04:49:48 +0000
committerFred Fish <fnf@specifix.com>1992-06-24 04:49:48 +0000
commite676a15f0b9ef089973311249917e203917b3903 (patch)
treeac8656c9b5795932c78ea01ea53ce9eabee5a9ae /gdb/infptrace.c
parent0fd24984ce2d13dd7ec231afa5b42e60ff1f1858 (diff)
downloadgdb-e676a15f0b9ef089973311249917e203917b3903.zip
gdb-e676a15f0b9ef089973311249917e203917b3903.tar.gz
gdb-e676a15f0b9ef089973311249917e203917b3903.tar.bz2
* Makefile.in (VERSION): Bump to 4.5.6.
* coffread.c (coff_end_symtab): Cast 2nd arg of complain() to correct type. * defs.h (NORETURN): Define away for Lucid compiler. * remote.c (remote_timer, remote_interrupt): Signal handlers take one int arg. * ser-termios.c (serial_write, serial_close): Return whatever value the write/close call returns, rather than falling off end. * inferior.h (PTRACE_ARG3_TYPE): Third arg to ptrace is int on more systems than it is "char *". Define PTRACE_ARG3_TYPE to default to int. * infptrace.c, hppabsd-xdep.c, hppahpux-xdep.c, i386-xdep.c, inferior.h (call_ptrace): Use PTRACE_ARG3_TYPE to declare type of third arg. * a68v-xdep.c, arm-xdep.c, convex-xdep.c, hp300ux-xdep.c, infrun.c, m88k-xdep.c, mach386-xdep.c, mips-xdep.c, os68k-xdep.c, pyr-tdep.c, pyr-xdep.c, rs6000-xdep.c, sparc-xdep.c, sun3-xdep.c, sun386-xdep.c, symm-xdep.c, ultra3-xdep.c: Use PTRACE_ARG3_TYPE to cast ptrace argument 3. * sparc-xdep.c, a68v-xdep.c (fetch_inferior_registers, store_inferior_registers): Supply missing fourth argument to ptrace().
Diffstat (limited to 'gdb/infptrace.c')
-rw-r--r--gdb/infptrace.c61
1 files changed, 37 insertions, 24 deletions
diff --git a/gdb/infptrace.c b/gdb/infptrace.c
index 3c26c87..5246157 100644
--- a/gdb/infptrace.c
+++ b/gdb/infptrace.c
@@ -17,7 +17,6 @@ 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. */
-#include <stdio.h>
#include "defs.h"
#include "frame.h"
#include "inferior.h"
@@ -66,13 +65,16 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <a.out.h> /* For struct nlist */
#endif /* KERNEL_U_ADDR_BSD. */
#endif /* !FETCH_INFERIOR_REGISTERS */
+
/* This function simply calls ptrace with the given arguments.
It exists so that all calls to ptrace are isolated in this
machine-dependent file. */
int
call_ptrace (request, pid, addr, data)
- int request, pid, *addr, data;
+ int request, pid;
+ PTRACE_ARG3_TYPE addr;
+ int data;
{
return ptrace (request, pid, addr, data);
}
@@ -90,7 +92,7 @@ kill_inferior_fast ()
{
if (inferior_pid == 0)
return;
- ptrace (PT_KILL, inferior_pid, 0, 0);
+ ptrace (PT_KILL, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0);
wait ((int *)0);
}
@@ -112,14 +114,22 @@ child_resume (step, signal)
{
errno = 0;
- /* An address of (int *)1 tells ptrace to continue from where it was.
- (If GDB wanted it to start some other way, we have already written
- a new PC value to the child.) */
+ /* An address of (PTRACE_ARG3_TYPE)1 tells ptrace to continue from where
+ it was. (If GDB wanted it to start some other way, we have already
+ written a new PC value to the child.) */
if (step)
- ptrace (PT_STEP, inferior_pid, (int *)1, signal);
+#ifdef NO_SINGLE_STEP
+ single_step (signal);
+#else
+ ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
+#endif
else
- ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal);
+#ifdef AIX_BUGGY_PTRACE_CONTINUE
+ AIX_BUGGY_PTRACE_CONTINUE;
+#else
+ ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
+#endif
if (errno)
perror_with_name ("ptrace");
@@ -136,7 +146,7 @@ attach (pid)
int pid;
{
errno = 0;
- ptrace (PT_ATTACH, pid, 0, 0);
+ ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0);
if (errno)
perror_with_name ("ptrace");
attach_flag = 1;
@@ -152,7 +162,7 @@ detach (signal)
int signal;
{
errno = 0;
- ptrace (PT_DETACH, inferior_pid, 1, signal);
+ ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
if (errno)
perror_with_name ("ptrace");
attach_flag = 0;
@@ -211,7 +221,8 @@ void _initialize_kernel_u_addr ()
#if !defined (U_REGS_OFFSET)
#define U_REGS_OFFSET \
ptrace (PT_READ_U, inferior_pid, \
- (int *)(offsetof (struct user, u_ar0)), 0) - KERNEL_U_ADDR
+ (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0) \
+ - KERNEL_U_ADDR
#endif
/* Registers we shouldn't try to fetch. */
@@ -246,7 +257,8 @@ fetch_register (regno)
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
- *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, (int *)regaddr, 0);
+ *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
if (errno != 0)
{
@@ -280,7 +292,7 @@ fetch_inferior_registers (regno)
If REGNO is -1, do this for all registers.
Otherwise, REGNO specifies which register (so we can save time). */
-int
+void
store_inferior_registers (regno)
int regno;
{
@@ -288,7 +300,6 @@ store_inferior_registers (regno)
char buf[80];
extern char registers[];
register int i;
- int result = 0;
unsigned int offset = U_REGS_OFFSET;
@@ -298,13 +309,12 @@ store_inferior_registers (regno)
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
{
errno = 0;
- ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr,
+ ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
*(int *) &registers[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
- result = -1;
}
regaddr += sizeof(int);
}
@@ -319,19 +329,17 @@ store_inferior_registers (regno)
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
{
errno = 0;
- ptrace (PT_WRITE_U, inferior_pid, (int *)regaddr,
+ ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
*(int *) &registers[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
sprintf (buf, "writing register number %d(%d)", regno, i);
perror_with_name (buf);
- result = -1;
}
regaddr += sizeof(int);
}
}
}
- return result;
}
#endif /* !defined (FETCH_INFERIOR_REGISTERS). */
@@ -373,14 +381,16 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
if (addr != memaddr || len < (int)sizeof (int)) {
/* Need part of initial word -- fetch it. */
- buffer[0] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0);
+ buffer[0] = ptrace (PT_READ_I, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ 0);
}
if (count > 1) /* FIXME, avoid if even boundary */
{
buffer[count - 1]
= ptrace (PT_READ_I, inferior_pid,
- (int *)(addr + (count - 1) * sizeof (int)), 0);
+ (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)),
+ 0);
}
/* Copy data to be written over corresponding part of buffer */
@@ -392,13 +402,15 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
for (i = 0; i < count; i++, addr += sizeof (int))
{
errno = 0;
- ptrace (PT_WRITE_D, inferior_pid, (int *)addr, buffer[i]);
+ ptrace (PT_WRITE_D, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i]);
if (errno)
{
/* Using the appropriate one (I or D) is necessary for
Gould NP1, at least. */
errno = 0;
- ptrace (PT_WRITE_I, inferior_pid, (int *)addr, buffer[i]);
+ ptrace (PT_WRITE_I, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i]);
}
if (errno)
return 0;
@@ -410,7 +422,8 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
for (i = 0; i < count; i++, addr += sizeof (int))
{
errno = 0;
- buffer[i] = ptrace (PT_READ_I, inferior_pid, (int *)addr, 0);
+ buffer[i] = ptrace (PT_READ_I, inferior_pid,
+ (PTRACE_ARG3_TYPE) addr, 0);
if (errno)
return 0;
QUIT;