+Tue Jun 23 21:46:26 1992 Fred Fish (fnf@cygnus.com)
+
+ * 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().
+
Mon Jun 22 20:18:06 1992 Fred Fish (fnf@cygnus.com)
* command.c (add_abbrev_prefix_cmd): Fix misspelling in comment.
ADD_FILES = ${REGEX} ${ALLOCA} ${XM_ADD_FILES} ${TM_ADD_FILES}
ADD_DEPS = ${REGEX1} ${ALLOCA1} ${XM_ADD_FILES} ${TM_ADD_FILES}
-VERSION = 4.5.5
+VERSION = 4.5.6
DIST=gdb
LINT=/usr/5bin/lint
registers_fetched ();
- ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers, 0);
#ifdef FP0_REGNUM
- ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
#endif
bcopy (&inferior_registers, registers, 16 * 4);
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers, 0);
#if FP0_REGNUM
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
#endif
}
struct user u;
unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
+ offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0)
+ - KERNEL_U_ADDR;
registers_fetched ();
for (regno = 0; regno < 16; regno++)
{
regaddr = offset + regno * 4;
- *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, regaddr, 0);
+ *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
if (regno == PC_REGNUM)
*(int *)&buf[0] = GET_PC_PART(*(int *)&buf[0]);
supply_register (regno, buf);
}
- *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid, offset + PC*4);
+ *(int *)&buf[0] = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) (offset + PC*4), 0);
supply_register (PS_REGNUM, buf); /* set virtual register ps same as pc */
/* read the floating point registers */
offset = (char *) &u.u_fp_regs - (char *)&u;
- *(int *)buf = ptrace (PT_READ_U, inferior_pid, offset, 0);
+ *(int *)buf = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0);
supply_register (FPS_REGNUM, buf);
for (regno = 16; regno < 24; regno++) {
regaddr = offset + 4 + 12 * (regno - 16);
for (i = 0; i < 12; i += sizeof(int))
- *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid, regaddr + i, 0);
+ *(int *) &buf[i] = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) (regaddr + i), 0);
supply_register (regno, buf);
}
}
struct user u;
unsigned long value;
unsigned int offset = (char *) &u.u_ar0 - (char *) &u;
- offset = ptrace (PT_READ_U, inferior_pid, offset, 0) - KERNEL_U_ADDR;
+ offset = ptrace (PT_READ_U, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0)
+ - KERNEL_U_ADDR;
if (regno >= 0) {
if (regno >= 16) return;
value = read_register(regno);
if (regno == PC_REGNUM)
value = SET_PC_PART(read_register (PS_REGNUM), value);
- ptrace (PT_WRITE_U, inferior_pid, regaddr, value);
+ ptrace (PT_WRITE_U, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
value = read_register(regno);
if (regno == PC_REGNUM)
value = SET_PC_PART(read_register (PS_REGNUM), value);
- ptrace (6, inferior_pid, regaddr, value);
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
if (errno != 0)
{
sprintf (buf, "writing all regs, number %d", regno);
if (BLOCK_START(pb->block) < BLOCK_START(pbnext->block)) {
struct block *tmp = pb->block;
- complain (&misordered_blocks_complaint, BLOCK_START (pb->block));
+ complain (&misordered_blocks_complaint,
+ (char *) BLOCK_START (pb->block));
pb->block = pbnext->block;
pbnext->block = tmp;
swapped = 1;
int
call_ptrace (request, pid, procaddr, buf)
- int request, pid, procaddr, buf;
+ int request, pid;
+ PTRACE_ARG3_TYPE procaddr;
+ int buf;
{
if (request == 0)
return;
extern void
printchar PARAMS ((int, FILE *, int));
+extern char *
+strdup_demangled PARAMS ((const char *));
+
extern void
fprint_symbol PARAMS ((FILE *, char *));
to keep them happy */
#ifndef NORETURN
-# define NORETURN volatile
+# ifdef __lucid
+# define NORETURN /*nothing*/
+# else
+# define NORETURN volatile
+# endif
#endif
/* Defaults for system-wide constants (if not defined by xm.h, we fake it). */
extern int
parse_escape PARAMS ((char **));
-extern char *reg_names[];
+extern const char * const reg_names[];
extern NORETURN void /* Does not return to the caller. */
error ();
# ifdef sparc
# include <alloca.h>
# endif
- extern char *alloca ();
+# ifndef alloca /* May be macro, with args, in <alloca.h> */
+ extern char *alloca ();
+# endif
# endif
#endif
#define INFERIOR_AR0(u) \
((ptrace \
- (PT_RUAREA, inferior_pid, ((char *) &u.u_ar0 - (char *) &u), 0)) \
+ (PT_RUAREA, inferior_pid, \
+ (PTRACE_ARG3_TYPE) ((char *) &u.u_ar0 - (char *) &u), 0)) \
- KERNEL_U_ADDR)
static void
union { int i; short s[2]; } ps_val;
int regval;
- ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0));
+ ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ 0));
regval = ps_val.s[0];
supply_register (regno, ®val);
}
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
- *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid, regaddr, 0);
+ *(int *) &buf[i] = ptrace (PT_RUAREA, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
}
supply_register (regno, buf);
int value;
{
errno = 0;
- ptrace (PT_WUAREA, inferior_pid, regaddr, value);
+ ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr, value);
#if 0
/* HP-UX randomly sets errno to non-zero for regno == 25.
However, the value is correctly written, so ignore errno. */
{
union { int i; short s[2]; } ps_val;
- ps_val.i = (ptrace (PT_RUAREA, inferior_pid, regaddr, 0));
+ ps_val.i = (ptrace (PT_RUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ 0));
ps_val.s[0] = (read_register (regno));
store_inferior_register_1 (regno, regaddr, ps_val.i);
}
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);
}
{
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);
}
{
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);
+ ptrace (PT_STEP, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
else
- ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal);
+ ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal);
if (errno)
perror_with_name ("ptrace");
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;
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;
#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. */
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
- *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, (int *)regaddr, 0);
+ *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
if (errno != 0)
{
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 *) ®isters[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
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 *) ®isters[REGISTER_BYTE (regno) + i]);
if (errno != 0)
{
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 */
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;
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;
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, 0);
}
{
if (inferior_pid == 0)
return;
- ptrace (PT_EXIT, inferior_pid, 0, 0, 0); /* PT_EXIT = PT_KILL ? */
+ ptrace (PT_EXIT, inferior_pid, (PTRACE_ARG3_TYPE) 0, 0, 0); /* PT_EXIT = PT_KILL ? */
wait ((int *)0);
}
{
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_SINGLE, inferior_pid, (int *)1, signal, 0);
+ ptrace (PT_SINGLE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0);
else
- ptrace (PT_CONTIN, inferior_pid, (int *)1, signal, 0);
+ ptrace (PT_CONTIN, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0);
if (errno)
perror_with_name ("ptrace");
int pid;
{
errno = 0;
- ptrace (PT_ATTACH, pid, 0, 0, 0);
+ ptrace (PT_ATTACH, pid, (PTRACE_ARG3_TYPE) 0, 0, 0);
if (errno)
perror_with_name ("ptrace");
attach_flag = 1;
int signal;
{
errno = 0;
- ptrace (PT_DETACH, inferior_pid, 1, signal, 0);
+ ptrace (PT_DETACH, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0);
if (errno)
perror_with_name ("ptrace");
attach_flag = 0;
#if !defined (U_REGS_OFFSET)
#define U_REGS_OFFSET \
ptrace (PT_READ_U, inferior_pid, \
- (int *)(offsetof (struct user, u_ar0)), 0, 0) - KERNEL_U_ADDR
+ (PTRACE_ARG3_TYPE) (offsetof (struct user, u_ar0)), 0, 0) \
+ - KERNEL_U_ADDR
#endif
/* Registers we shouldn't try to fetch. */
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
errno = 0;
- *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid, (int *)regaddr, 0, 0);
+ *(int *) &buf[i] = ptrace (PT_RUREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0, 0);
regaddr += sizeof (int);
if (errno != 0)
{
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
{
errno = 0;
- ptrace (PT_WUAREA, inferior_pid, (int *)regaddr,
+ ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
*(int *) ®isters[REGISTER_BYTE (regno) + i], 0);
if (errno != 0)
{
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof(int))
{
errno = 0;
- ptrace (PT_WUAREA, inferior_pid, (int *)regaddr,
+ ptrace (PT_WUAREA, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
*(int *) ®isters[REGISTER_BYTE (regno) + i], 0);
if (errno != 0)
{
if (addr != memaddr || len < (int)sizeof (int)) {
/* Need part of initial word -- fetch it. */
- buffer[0] = ptrace (PT_RIUSER, inferior_pid, (int *)addr, 0, 0);
+ buffer[0] = ptrace (PT_RIUSER, inferior_pid,
+ (PTRACE_ARG3_TYPE) addr, 0, 0);
}
if (count > 1) /* FIXME, avoid if even boundary */
{
buffer[count - 1]
= ptrace (PT_RIUSER, inferior_pid,
- (int *)(addr + (count - 1) * sizeof (int)), 0, 0);
+ (PTRACE_ARG3_TYPE) (addr + (count - 1) * sizeof (int)),
+ 0, 0);
}
/* Copy data to be written over corresponding part of buffer */
for (i = 0; i < count; i++, addr += sizeof (int))
{
errno = 0;
- ptrace (PT_WDUSER, inferior_pid, (int *)addr, buffer[i], 0);
+ ptrace (PT_WDUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i], 0);
if (errno)
{
/* Using the appropriate one (I or D) is necessary for
Gould NP1, at least. */
errno = 0;
- ptrace (PT_WIUSER, inferior_pid, (int *)addr, buffer[i], 0);
+ ptrace (PT_WIUSER, inferior_pid, (PTRACE_ARG3_TYPE) addr,
+ buffer[i], 0);
}
if (errno)
return 0;
for (i = 0; i < count; i++, addr += sizeof (int))
{
errno = 0;
- buffer[i] = ptrace (PT_RIUSER, inferior_pid, (int *)addr, 0, 0);
+ buffer[i] = ptrace (PT_RIUSER, inferior_pid,
+ (PTRACE_ARG3_TYPE) addr, 0, 0);
if (errno)
return 0;
QUIT;
unsigned int mask;
rounded_addr = uaddr & -sizeof (int);
- data = ptrace (3, inferior_pid, rounded_addr, 0);
+ data = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0);
mask = 0xff << ((uaddr - rounded_addr) * 8);
fpvalid = ((data & mask) != 0);
ip = (int *)buf;
for (i = 0; i < rounded_size; i++)
{
- *ip++ = ptrace (3, inferior_pid, rounded_addr, 0);
+ *ip++ = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) rounded_addr, 0);
rounded_addr += sizeof (int);
}
}
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"
#include <sys/param.h>
#include <signal.h>
-extern char *strerror(); /* strings corresponding to errno */
+static void
+kill_command PARAMS ((char *, int));
+
+static void
+terminal_ours_1 PARAMS ((int));
extern struct target_ops child_ops;
/* Does GDB have a terminal (on stdin)? */
int gdb_has_a_terminal;
-
+#if !defined(__GO32__)
static TERMINAL sg_inferior;
static TERMINAL sg_ours;
-
+#endif
static int tflags_inferior;
static int tflags_ours;
void
terminal_init_inferior ()
{
+#if !defined(__GO32__)
sg_inferior = sg_ours;
tflags_inferior = tflags_ours;
#ifdef TIOCGPGRP
pgrp_inferior = inferior_pid;
#endif /* TIOCGPGRP */
-
+#endif
terminal_is_ours = 1;
}
void
terminal_inferior ()
{
+#if !defined(__GO32__)
int result;
if (gdb_has_a_terminal && terminal_is_ours && inferior_thisrun_terminal == 0)
sigquit_ours = (void (*) ()) signal (SIGQUIT, SIG_IGN);
#endif /* TIOCGPGRP */
}
+#endif
terminal_is_ours = 0;
}
terminal_ours_1 (output_only)
int output_only;
{
+#if !defined(__GO32__)
int result;
#ifdef TIOCGPGRP
/* Ignore this signal since it will happen when we try to set the pgrp. */
#else /* not HAVE_TERMIO */
sg_ours.sg_flags &= ~RAW & ~CBREAK;
#endif /* not HAVE_TERMIO */
+
+ result = result; /* lint */
+#endif
}
/* ARGSUSED */
printf_filtered ("This GDB does not control a terminal.\n");
return;
}
-
+#if !defined(__GO32__)
#ifdef TIOCGPGRP
printf_filtered ("Inferior's terminal status (currently saved by GDB):\n");
#ifdef TIOCLGET
printf_filtered ("lmode: 0x%x\n", lmode_inferior);
#endif
+#else
+ printf_filtered("This is a DOS machine; there is no terminal state\n");
+#endif
+
}
\f
/* NEW_TTY_PREFORK is called before forking a new child process,
new_tty ()
{
register int tty;
+ void (*osigttou) ();
if (inferior_thisrun_terminal == 0)
return;
-
+#if !defined(__GO32__)
#ifdef TIOCNOTTY
- /* Disconnect the child process from our controlling terminal. */
+ /* Disconnect the child process from our controlling terminal. On some
+ systems (SVR4 for example), this may cause a SIGTTOU, so temporarily
+ ignore SIGTTOU. */
tty = open("/dev/tty", O_RDWR);
if (tty > 0)
{
+ osigttou = (void (*)()) signal(SIGTTOU, SIG_IGN);
ioctl(tty, TIOCNOTTY, 0);
close(tty);
+ (void) signal(SIGTTOU, osigttou);
}
#endif
{ close (2); dup (tty); }
if (tty > 2)
close(tty);
+#endif /* !go32*/o
}
\f
/* Kill the inferior process. Make us have no inferior. */
{
QUIT;
errno = 0;
- value = call_ptrace (3, inferior_pid, i, 0);
- call_ptrace (6, inferior_pid, i, value);
+ value = call_ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) i, 0);
+ call_ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) i, value);
if (errno == 0)
{
printf (" Succeeded with address 0x%x; value 0x%x (%d).\n",
/* Get all the current tty settings (including whether we have a tty at
all!). */
+#if !defined(__GO32__)
tflags_ours = fcntl (0, F_GETFL, 0);
- OOPSY ("fcntl F_GETFL"); /* Should always work */
result = ioctl (0, TIOCGETP, &sg_ours);
if (result == 0) {
} else {
gdb_has_a_terminal = 0;
}
+#else
+ gdb_has_a_terminal = 0;
+#endif
+
terminal_is_ours = 1;
}
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"
#include <a.out.h> /* For struct nlist */
#endif /* KERNEL_U_ADDR_BSD. */
#endif /* !FETCH_INFERIOR_REGISTERS */
+
\f
/* 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);
}
{
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);
}
{
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");
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;
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;
#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. */
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)
{
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;
{
char buf[80];
extern char registers[];
register int i;
- int result = 0;
unsigned int offset = U_REGS_OFFSET;
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 *) ®isters[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);
}
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 *) ®isters[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). */
\f
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 */
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;
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;
for the inferior. */
#ifdef USE_PROC_FS
- proc_set_exec_trap (); /* Use SVR4 /proc interface */
+ /* Use SVR4 /proc interface */
+ proc_set_exec_trap ();
#else
- call_ptrace (0, 0, 0, 0); /* "Trace me, Dr. Memory!" */
+ /* "Trace me, Dr. Memory!" */
+ call_ptrace (0, 0, (PTRACE_ARG3_TYPE) 0, 0);
#endif
/* There is no execlpe call, so we have to set the environment
offset = (char *) &u.pt_r0 - (char *) &u;
regaddr = offset; /* byte offset to r0;*/
-/* offset = ptrace (3, inferior_pid, offset, 0) - KERNEL_U_ADDR; */
+/* offset = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) offset, 0) - KERNEL_U_ADDR; */
for (regno = 0; regno < NUM_REGS; regno++)
{
/*regaddr = register_addr (regno, offset);*/
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
- *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0);
+ *(int *) &buf[i] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
}
supply_register (regno, buf);
}
/* now load up registers 36 - 38; special pc registers */
- *(int *) &buf[0] = ptrace (3,inferior_pid,SXIP_OFFSET ,0);
+ *(int *) &buf[0] = ptrace (3,inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET ,0);
supply_register (SXIP_REGNUM, buf);
- *(int *) &buf[0] = ptrace (3, inferior_pid,SNIP_OFFSET,0);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET,0);
supply_register (SNIP_REGNUM, buf);
- *(int *) &buf[0] = ptrace (3, inferior_pid,SFIP_OFFSET,0);
+ *(int *) &buf[0] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET,0);
supply_register (SFIP_REGNUM, buf);
}
{
regaddr = offset + regno * sizeof (int);
errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
}
}
else if (regno == SXIP_REGNUM)
- ptrace (6, inferior_pid, SXIP_OFFSET, read_register(regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET, read_register(regno));
else if (regno == SNIP_REGNUM)
- ptrace (6, inferior_pid, SNIP_OFFSET, read_register(regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET, read_register(regno));
else if (regno == SFIP_REGNUM)
- ptrace (6, inferior_pid, SFIP_OFFSET, read_register(regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET, read_register(regno));
else printf ("Bad register number for store_inferior routine\n");
}
else {
/* regaddr = register_addr (regno, offset); */
errno = 0;
regaddr = offset + regno * sizeof (int);
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
perror_with_name (buf);
}
}
- ptrace (6,inferior_pid,SXIP_OFFSET,read_register(SXIP_REGNUM));
- ptrace (6,inferior_pid,SNIP_OFFSET,read_register(SNIP_REGNUM));
- ptrace (6,inferior_pid,SFIP_OFFSET,read_register(SFIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SXIP_OFFSET,read_register(SXIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SNIP_OFFSET,read_register(SNIP_REGNUM));
+ ptrace (6,inferior_pid,
+ (PTRACE_ARG3_TYPE) SFIP_OFFSET,read_register(SFIP_REGNUM));
}
registers_fetched ();
- ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
bcopy (&inferior_registers, registers, sizeof inferior_registers);
instruction that moves eax into ebp gets single-stepped. */
{
int stack = inferior_registers.r_reg[SP_REGNUM];
- int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, stack);
+ int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid,
+ (PTRACE_ARG3_TYPE) stack);
int reg = inferior_registers.r_reg[EAX];
inferior_registers.r_reg[EAX] =
inferior_registers.r_reg[FP_REGNUM];
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_POKEDATA, inferior_pid, stack, 0xc589);
- ptrace (PTRACE_SINGLESTEP, inferior_pid, stack, 0);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0xc589);
+ ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack, 0);
wait (0);
- ptrace (PTRACE_POKEDATA, inferior_pid, stack, stuff);
+ ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack, stuff);
inferior_registers.r_reg[EAX] = reg;
}
#endif
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
}
#else /* Not mach386 target. */
regaddr = REGISTER_PTRACE_ADDR (regno);
for (i = 0; i < REGISTER_RAW_SIZE (regno); i += sizeof (int))
{
- *(int *) &buf[i] = ptrace (3, inferior_pid, regaddr, 0);
+ *(int *) &buf[i] = ptrace (3, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, 0);
regaddr += sizeof (int);
}
supply_register (regno, buf);
{
regaddr = REGISTER_PTRACE_ADDR (regno);
errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
continue;
regaddr = register_addr (regno, 1);
errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing all regs, number %d", regno);
registers_fetched ();
- ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
#ifdef FP0_REGNUM
- ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
#endif
bcopy (&inferior_registers, registers, 16 * 4);
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
#if FP0_REGNUM
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
#endif
}
SYNOPSIS
- int ptrace (int request, int pid, int arg3, int arg4)
+ int ptrace (int request, int pid, PTRACE_ARG3_TYPE arg3, int arg4)
DESCRIPTION
ptrace (request, pid, arg3, arg4)
int request;
int pid;
- int arg3;
+ PTRACE_ARG3_TYPE arg3;
int arg4;
{
error ("internal error - there is a call to ptrace() somewhere");
reg_names[regno+48], reg_buf[regno+48]);
}
usp = ptrace (3, inferior_pid,
- ((char *)&u.u_pcb.pcb_usp) -
- ((char *)&u), 0);
+ (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_usp) -
+ ((char *)&u), 0);
ksp = ptrace (3, inferior_pid,
- ((char *)&u.u_pcb.pcb_ksp) -
- ((char *)&u), 0);
+ (PTRACE_ARG3_TYPE) ((char *)&u.u_pcb.pcb_ksp) -
+ ((char *)&u), 0);
printf/*_filtered*/ ("\n%6.6s: %8x %6.6s: %8x (%08x) %6.6s %8x\n",
reg_names[CSP_REGNUM],reg_buf[CSP_REGNUM],
reg_names[KSP_REGNUM], reg_buf[KSP_REGNUM], ksp,
registers_fetched ();
for (regno = 0; regno < 64; regno++) {
- reg_buf[regno] = ptrace (3, inferior_pid, regno, 0);
+ reg_buf[regno] = ptrace (3, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0);
#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
printf ("Fetching %s from inferior, got %0x\n",
}
/* that leaves regs 64, 65, and 66 */
datum = ptrace (3, inferior_pid,
- ((char *)&u.u_pcb.pcb_csp) -
- ((char *)&u), 0);
+ (PTRACE_ARG3_TYPE) (((char *)&u.u_pcb.pcb_csp) -
+ ((char *)&u)), 0);
while (1) {
register int inferior_saved_pc;
- inferior_saved_pc = ptrace (1, inferior_pid, datum+((32+15)*4), 0);
+ inferior_saved_pc = ptrace (1, inferior_pid,
+ (PTRACE_ARG3_TYPE) (datum+((32+15)*4)), 0);
if (inferior_saved_pc > 0) break;
#if defined(PYRAMID_CONTROL_FRAME_DEBUGGING)
printf("skipping kernel frame %08x, pc=%08x\n", datum,
/*regaddr = register_addr (regno, offset);*/
regaddr = regno;
errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing register number %d", regno);
/*regaddr = register_addr (regno, offset);*/
regaddr = regno;
errno = 0;
- ptrace (6, inferior_pid, regaddr, read_register (regno));
+ ptrace (6, inferior_pid, (PTRACE_ARG3_TYPE) regaddr,
+ read_register (regno));
if (errno != 0)
{
sprintf (buf, "writing all regs, number %d", regno);
/* Called when SIGALRM signal sent due to alarm() timeout. */
#ifndef HAVE_TERMIO
void
-remote_timer ()
+remote_timer (signo)
+ int signo;
{
if (kiodebug)
printf ("remote_timer called\n");
/* Send ^C to target to halt it. Target will respond, and send us a
packet. */
-void remote_interrupt()
+void remote_interrupt(signo)
+ int signo;
{
if (kiodebug)
}
one_stepped = 1;
- ptrace (PT_CONTINUE, inferior_pid, 1, signal, 0);
+ ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) 1, signal, 0);
}
else {
for (ii=0; ii < 32; ++ii)
*(int*)®isters[REGISTER_BYTE (ii)] =
- ptrace (PT_READ_GPR, inferior_pid, ii, 0, 0);
+ ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii, 0, 0);
/* read general purpose floating point registers. */
for (ii=0; ii < 32; ++ii)
ptrace (PT_READ_FPR, inferior_pid,
- (int*)®isters [REGISTER_BYTE (FP0_REGNUM+ii)], FPR0+ii, 0);
+ (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (FP0_REGNUM+ii)],
+ FPR0+ii, 0);
/* read special registers. */
for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii)
*(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)] =
- ptrace (PT_READ_GPR, inferior_pid, special_regs[ii], 0, 0);
+ ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) special_regs[ii],
+ 0, 0);
registers_fetched ();
return;
else if (regno < FP0_REGNUM) { /* a GPR */
*(int*)®isters[REGISTER_BYTE (regno)] =
- ptrace (PT_READ_GPR, inferior_pid, regno, 0, 0);
+ ptrace (PT_READ_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno, 0, 0);
}
else if (regno <= FPLAST_REGNUM) { /* a FPR */
ptrace (PT_READ_FPR, inferior_pid,
- (int*)®isters [REGISTER_BYTE (regno)], (regno-FP0_REGNUM+FPR0), 0);
+ (PTRACE_ARG3_TYPE) ®isters [REGISTER_BYTE (regno)],
+ (regno-FP0_REGNUM+FPR0), 0);
}
else if (regno <= LAST_SP_REGNUM) { /* a special register */
*(int*)®isters[REGISTER_BYTE (regno)] =
ptrace (PT_READ_GPR, inferior_pid,
- special_regs[regno-FIRST_SP_REGNUM], 0, 0);
+ (PTRACE_ARG3_TYPE) special_regs[regno-FIRST_SP_REGNUM], 0, 0);
}
else
fprintf (stderr, "gdb error: register no %d not implemented.\n", regno);
/* write general purpose registers first! */
for ( ii=GPR0; ii<=GPR31; ++ii) {
- ptrace (PT_WRITE_GPR, inferior_pid, ii,
+ ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) ii,
*(int*)®isters[REGISTER_BYTE (ii)], 0);
if ( errno ) {
perror ("ptrace write_gpr"); errno = 0;
/* write floating point registers now. */
for ( ii=0; ii < 32; ++ii) {
ptrace (PT_WRITE_FPR, inferior_pid,
- (int*)®isters[REGISTER_BYTE (FP0_REGNUM+ii)], FPR0+ii, 0);
+ (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (FP0_REGNUM+ii)],
+ FPR0+ii, 0);
if ( errno ) {
perror ("ptrace write_fpr"); errno = 0;
}
/* write special registers. */
for (ii=0; ii <= LAST_SP_REGNUM-FIRST_SP_REGNUM; ++ii) {
- ptrace (PT_WRITE_GPR, inferior_pid, special_regs[ii],
- *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)], 0);
+ ptrace (PT_WRITE_GPR, inferior_pid,
+ (PTRACE_ARG3_TYPE) special_regs[ii],
+ *(int*)®isters[REGISTER_BYTE (FIRST_SP_REGNUM+ii)], 0);
if ( errno ) {
perror ("ptrace write_gpr"); errno = 0;
}
else if (regno < FP0_REGNUM) { /* a GPR */
- ptrace (PT_WRITE_GPR, inferior_pid, regno,
+ ptrace (PT_WRITE_GPR, inferior_pid, (PTRACE_ARG3_TYPE) regno,
*(int*)®isters[REGISTER_BYTE (regno)], 0);
}
else if (regno <= FPLAST_REGNUM) { /* a FPR */
ptrace (PT_WRITE_FPR, inferior_pid,
- (int*)®isters[REGISTER_BYTE (regno)], regno-FP0_REGNUM+FPR0, 0);
+ (PTRACE_ARG3_TYPE) ®isters[REGISTER_BYTE (regno)],
+ regno-FP0_REGNUM+FPR0, 0);
}
else if (regno <= LAST_SP_REGNUM) { /* a special register */
- ptrace (PT_WRITE_GPR, inferior_pid, special_regs [regno-FIRST_SP_REGNUM],
- *(int*)®isters[REGISTER_BYTE (regno)], 0);
+ ptrace (PT_WRITE_GPR, inferior_pid,
+ (PTRACE_ARG3_TYPE) special_regs [regno-FIRST_SP_REGNUM],
+ *(int*)®isters[REGISTER_BYTE (regno)], 0);
}
else
usleep (36000);
errno = 0;
- ptrace(PT_LDINFO, pid, ldi, MAX_LOAD_SEGS * sizeof(*ldi), ldi);
+ ptrace(PT_LDINFO, pid, (PTRACE_ARG3_TYPE) ldi,
+ MAX_LOAD_SEGS * sizeof(*ldi), ldi);
if (errno) {
perror_with_name ("ptrace ldinfo");
return 0;
target_insert_breakpoint (DUMMY_INSN_ADDR, &shadow);
errno = 0;
- ptrace (PT_CONTINUE, inferior_pid, DUMMY_INSN_ADDR, 0, 0);
+ ptrace (PT_CONTINUE, inferior_pid, (PTRACE_ARG3_TYPE) DUMMY_INSN_ADDR, 0, 0);
if (errno)
perror ("pt_continue");
CONST char *str AND
int len)
{
- write (desc, str, len);
+ return (write (desc, str, len));
}
int
DEFUN_VOID(serial_close)
{
-close(desc);
+ return (close(desc));
}
|| regno >= Y_REGNUM
|| (!register_valid[SP_REGNUM] && regno < I7_REGNUM))
{
- if (0 != ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers))
- perror("ptrace_getregs");
+ if (0 != ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers, 0))
+ perror("ptrace_getregs");
registers[REGISTER_BYTE (0)] = 0;
bcopy (&inferior_registers.r_g1, ®isters[REGISTER_BYTE (1)], 15 * REGISTER_RAW_SIZE (G0_REGNUM));
/* Floating point registers */
if (regno == -1 || (regno >= FP0_REGNUM && regno <= FP0_REGNUM + 31))
{
- if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers))
+ if (0 != ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers,
+ 0))
perror("ptrace_getfpregs");
bcopy (&inferior_fp_registers, ®isters[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fpu_fr);
inferior_registers.r_y =
*(int *)®isters[REGISTER_BYTE (Y_REGNUM)];
- if (0 != ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers))
+ if (0 != ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers, 0))
perror("ptrace_setregs");
}
sizeof (FPU_FSR_TYPE));
****/
if (0 !=
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers))
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers, 0))
perror("ptrace_setfpregs");
}
}
registers_fetched ();
- ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
#ifdef FP0_REGNUM
- ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
#endif
bcopy (&inferior_registers, registers, 16 * 4);
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
#if FP0_REGNUM
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
#endif
}
registers_fetched ();
- ptrace (PTRACE_GETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_GETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_GETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_GETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
bcopy (&inferior_registers, registers, sizeof inferior_registers);
instruction that moves eax into ebp gets single-stepped. */
{
int stack = inferior_registers.r_reg[SP_REGNUM];
- int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid, stack);
+ int stuff = ptrace (PTRACE_PEEKDATA, inferior_pid,
+ (PTRACE_ARG3_TYPE) stack);
int reg = inferior_registers.r_reg[EAX];
inferior_registers.r_reg[EAX] =
inferior_registers.r_reg[FP_REGNUM];
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_POKEDATA, inferior_pid, stack, 0xc589);
- ptrace (PTRACE_SINGLESTEP, inferior_pid, stack, 0);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack,
+ 0xc589);
+ ptrace (PTRACE_SINGLESTEP, inferior_pid, (PTRACE_ARG3_TYPE) stack,
+ 0);
wait (0);
- ptrace (PTRACE_POKEDATA, inferior_pid, stack, stuff);
+ ptrace (PTRACE_POKEDATA, inferior_pid, (PTRACE_ARG3_TYPE) stack,
+ stuff);
inferior_registers.r_reg[EAX] = reg;
}
#endif
- ptrace (PTRACE_SETREGS, inferior_pid, &inferior_registers);
- ptrace (PTRACE_SETFPREGS, inferior_pid, &inferior_fp_registers);
+ ptrace (PTRACE_SETREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_registers);
+ ptrace (PTRACE_SETFPREGS, inferior_pid,
+ (PTRACE_ARG3_TYPE) &inferior_fp_registers);
}
/* Machine-dependent code which would otherwise be in core.c */
else
{
reg_tmp = *(int *)®isters[REGISTER_BYTE(regno)];
- ptrace(XPT_RREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
switch (regno)
{
case 0:
}
}
#endif /* 0 */
- ptrace(XPT_WREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_WREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
}
void
registers_fetched ();
- ptrace(XPT_RREGS, inferior_pid, ®s, 0);
+ ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®s, 0);
*(int *)®isters[REGISTER_BYTE(0)] = regs.pr_eax;
*(int *)®isters[REGISTER_BYTE(5)] = regs.pr_ebx;
*(int *)®isters[REGISTER_BYTE(2)] = regs.pr_ecx;
extern int corechan;
if (have_inferior_p()) {
- call_ptrace(XPT_RREGS, inferior_pid, ®set, 0);
+ call_ptrace(XPT_RREGS, inferior_pid, (PTRACE_ARG3_TYPE) ®set, 0);
} else {
if (lseek (corechan, 0, 0) < 0) {
perror ("seek on core file");
#define AIX_BUGGY_PTRACE_CONTINUE \
{ \
- int ret = ptrace (PT_CONTINUE, inferior_pid, (int *)1, signal, 0); \
+ int ret = ptrace (PT_CONTINUE, inferior_pid, \
+ (PTRACE_ARG3_TYPE) 1, signal, 0); \
if (errno) { \
/* printf ("ret: %d, errno: %d, signal: %d\n", ret, errno, signal); */ \
errno = 0; } \
supply_register (regno, &val);
} else {
errno = 0;
- val = ptrace (PT_READ_U, inferior_pid, (int*)register_addr(regno,0), 0);
+ val = ptrace (PT_READ_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) register_addr(regno,0), 0);
if (errno != 0) {
sprintf(buf,"reading register %s (#%d)",reg_names[regno],regno);
perror_with_name (buf);
/* Global Registers */
#ifdef ULTRA3
errno = 0;
- ptrace (PT_READ_STRUCT, inferior_pid, (int*)register_addr(GR96_REGNUM,0),
- (int)&pt_struct.pt_gr[0], 32*4);
+ ptrace (PT_READ_STRUCT, inferior_pid,
+ (PTRACE_ARG3_TYPE) register_addr(GR96_REGNUM,0),
+ (int)&pt_struct.pt_gr[0], 32*4);
if (errno != 0) {
perror_with_name ("reading global registers");
ret_val = -1;
/* Local Registers */
#ifdef ULTRA3
errno = 0;
- ptrace (PT_READ_STRUCT, inferior_pid, (int*)register_addr(LR0_REGNUM,0),
- (int)&pt_struct.pt_lr[0], 128*4);
+ ptrace (PT_READ_STRUCT, inferior_pid,
+ (PTRACE_ARG3_TYPE) register_addr(LR0_REGNUM,0),
+ (int)&pt_struct.pt_lr[0], 128*4);
if (errno != 0) {
perror_with_name ("reading local registers");
ret_val = -1;
return;
regaddr = register_addr (regno, 0);
errno = 0;
- ptrace (PT_WRITE_U, inferior_pid,(int*)regaddr,read_register(regno));
+ ptrace (PT_WRITE_U, inferior_pid,
+ (PTRACE_ARG3_TYPE) regaddr, read_register(regno));
if (errno != 0)
{
sprintf (buf, "writing register %s (#%d)", reg_names[regno],regno);
for (regno = LR0_REGNUM; regno < LR0_REGNUM+128; regno++)
pt_struct.pt_gr[regno] = read_register(regno);
errno = 0;
- ptrace (PT_WRITE_STRUCT, inferior_pid, (int*)register_addr(GR1_REGNUM,0),
- (int)&pt_struct.pt_gr1,(1*32*128)*4);
+ ptrace (PT_WRITE_STRUCT, inferior_pid,
+ (PTRACE_ARG3_TYPE) register_addr(GR1_REGNUM,0),
+ (int)&pt_struct.pt_gr1,(1*32*128)*4);
if (errno != 0)
{
sprintf (buf, "writing all local/global registers");
pt_struct.pt_bp = read_register(BP_REGNUM);
pt_struct.pt_fc = read_register(FC_REGNUM);
errno = 0;
- ptrace (PT_WRITE_STRUCT, inferior_pid, (int*)register_addr(CPS_REGNUM,0),
- (int)&pt_struct.pt_psr,(10)*4);
+ ptrace (PT_WRITE_STRUCT, inferior_pid,
+ (PTRACE_ARG3_TYPE) register_addr(CPS_REGNUM,0),
+ (int)&pt_struct.pt_psr,(10)*4);
if (errno != 0)
{
sprintf (buf, "writing all special registers");
extern char* realloc PARAMS (());
extern int free PARAMS (());
+/* SunOS 4.x uses nonstandard "char *" as type of third argument to ptrace() */
+
+#define PTRACE_ARG3_TYPE char*