/* IBM RS/6000 native-dependent code for GDB, the GNU debugger.
- Copyright 1986, 1987, 1989, 1991, 1992, 1994, 1995, 1996, 1997,
- 1998, 2001
+ Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
+ 1998, 1999, 2000, 2001
Free Software Foundation, Inc.
This file is part of GDB.
#include "libbfd.h" /* For bfd_cache_lookup (FIXME) */
#include "bfd.h"
#include "gdb-stabs.h"
+#include "regcache.h"
#include <sys/ptrace.h>
#include <sys/reg.h>
if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
{
nr = regno - FP0_REGNUM + FPR0;
- ptrace32 (PT_READ_FPR, inferior_pid, addr, nr, 0);
+ ptrace32 (PT_READ_FPR, PIDGET (inferior_ptid), addr, nr, 0);
}
/* Bogus register number. */
nr = regno;
if (!ARCH64 ())
- *addr = ptrace32 (PT_READ_GPR, inferior_pid, (int *)nr, 0, 0);
+ *addr = ptrace32 (PT_READ_GPR, PIDGET (inferior_ptid), (int *)nr, 0, 0);
else
{
/* PT_READ_GPR requires the buffer parameter to point to long long,
even if the register is really only 32 bits. */
long long buf;
- ptrace64 (PT_READ_GPR, inferior_pid, nr, 0, (int *)&buf);
+ ptrace64 (PT_READ_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf);
if (REGISTER_RAW_SIZE (regno) == 8)
memcpy (addr, &buf, 8);
else
if (regno >= FP0_REGNUM && regno <= FPLAST_REGNUM)
{
nr = regno - FP0_REGNUM + FPR0;
- ptrace32 (PT_WRITE_FPR, inferior_pid, addr, nr, 0);
+ ptrace32 (PT_WRITE_FPR, PIDGET (inferior_ptid), addr, nr, 0);
}
/* Bogus register number. */
nr = regno;
if (!ARCH64 ())
- ptrace32 (PT_WRITE_GPR, inferior_pid, (int *)nr, *addr, 0);
+ ptrace32 (PT_WRITE_GPR, PIDGET (inferior_ptid), (int *)nr, *addr, 0);
else
{
/* PT_WRITE_GPR requires the buffer parameter to point to an 8-byte
memcpy (&buf, addr, 8);
else
buf = *addr;
- ptrace64 (PT_WRITE_GPR, inferior_pid, nr, 0, (int *)&buf);
+ ptrace64 (PT_WRITE_GPR, PIDGET (inferior_ptid), nr, 0, (int *)&buf);
}
}
errno = 0;
if (arch64)
- *to = ptrace64 (PT_READ_I, inferior_pid, from, 0, NULL);
+ *to = ptrace64 (PT_READ_I, PIDGET (inferior_ptid), from, 0, NULL);
else
- *to = ptrace32 (PT_READ_I, inferior_pid, (int *)(long) from, 0, NULL);
+ *to = ptrace32 (PT_READ_I, PIDGET (inferior_ptid), (int *)(long) from,
+ 0, NULL);
return !errno;
}
int
child_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
- int write, struct target_ops *target)
+ int write, struct mem_attrib *attrib,
+ struct target_ops *target)
{
/* Round starting address down to 32-bit word boundary. */
int mask = sizeof (int) - 1;
for (i = 0, errno = 0; i < count; i++, addr += sizeof (int))
{
if (arch64)
- ptrace64 (PT_WRITE_D, inferior_pid, addr, buf[i], NULL);
+ ptrace64 (PT_WRITE_D, PIDGET (inferior_ptid), addr, buf[i], NULL);
else
- ptrace32 (PT_WRITE_D, inferior_pid, (int *)(long) addr,
+ ptrace32 (PT_WRITE_D, PIDGET (inferior_ptid), (int *)(long) addr,
buf[i], NULL);
if (errno)
prev_pc = read_pc ();
write_pc (DUMMY_INSN_ADDR);
if (ARCH64 ())
- ret = ptrace64 (PT_CONTINUE, inferior_pid, 1, 0, NULL);
+ ret = ptrace64 (PT_CONTINUE, PIDGET (inferior_ptid), 1, 0, NULL);
else
- ret = ptrace32 (PT_CONTINUE, inferior_pid, (int *)1, 0, NULL);
+ ret = ptrace32 (PT_CONTINUE, PIDGET (inferior_ptid), (int *)1, 0, NULL);
if (ret != 0)
perror ("pt_continue");
{
pid = wait (&status);
}
- while (pid != inferior_pid);
+ while (pid != PIDGET (inferior_ptid));
write_pc (prev_pc);
target_remove_breakpoint (DUMMY_INSN_ADDR, shadow_contents);