/* Low level interface for debugging AIX 4.3+ pthreads.
- Copyright (C) 1999-2013 Free Software Foundation, Inc.
+ Copyright (C) 1999-2014 Free Software Foundation, Inc.
Written by Nick Duffek <nsd@redhat.com>.
This file is part of GDB.
#include "regcache.h"
#include "gdbcmd.h"
#include "ppc-tdep.h"
-#include "gdb_string.h"
+#include <string.h>
#include "observer.h"
#include <procinfo.h>
{
errno = 0;
return ptrace_check (req, id,
- ptrace (req, id, (addr_ptr) addr, data, buf));
+ ptrace (req, id, addr, data, buf));
}
/* If *PIDP is a composite process/thread id, convert it to a
}
else
{
- if (!ptrace32 (PTT_READ_GPRS, tid, gprs32, 0, NULL))
+ if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
memcpy (context->gpr, gprs32, sizeof(gprs32));
}
/* Floating-point registers. */
if (flags & PTHDB_FLAG_FPRS)
{
- if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL))
+ if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
memcpy (context->fpr, fprs, sizeof(fprs));
}
}
else
{
- if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL))
+ if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
memset (&sprs32, 0, sizeof (sprs32));
memcpy (&context->msr, &sprs32, sizeof(sprs32));
}
ptrace64aix (PTT_WRITE_GPRS, tid,
(unsigned long) context->gpr, 0, NULL);
else
- ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) context->gpr, 0, NULL);
+ ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) context->gpr, 0, NULL);
}
/* Floating-point registers. */
if (flags & PTHDB_FLAG_FPRS)
{
- ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) context->fpr, 0, NULL);
+ ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) context->fpr, 0, NULL);
}
/* Special-purpose registers. */
}
else
{
- ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) &context->msr, 0, NULL);
+ ptrace32 (PTT_WRITE_SPRS, tid, (uintptr_t) &context->msr, 0, NULL);
}
}
return 0;
}
else if (gi == gcount)
{
- thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid);
+ thread = add_thread (ptid_build (infpid, 0, pbuf[pi].pthid));
thread->private = xmalloc (sizeof (struct private_thread_info));
thread->private->pdtid = pbuf[pi].pdtid;
thread->private->tid = pbuf[pi].tid;
/* Detach from the process attached to by aix_thread_attach(). */
static void
-aix_thread_detach (struct target_ops *ops, char *args, int from_tty)
+aix_thread_detach (struct target_ops *ops, const char *args, int from_tty)
{
struct target_ops *beneath = find_target_beneath (ops);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regcache_read_pc (regcache)
- - gdbarch_decr_pc_after_break (gdbarch) == pd_brk_addr)
+ - target_decr_pc_after_break (gdbarch) == pd_brk_addr)
return pd_activate (0);
}
}
else
{
- if (!ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) gprs32, 0, NULL))
+ if (!ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL))
memset (gprs32, 0, sizeof (gprs32));
for (i = 0; i < ppc_num_gprs; i++)
supply_reg32 (regcache, tdep->ppc_gp0_regnum + i, gprs32[i]);
|| (regno >= tdep->ppc_fp0_regnum
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
- if (!ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL))
+ if (!ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL))
memset (fprs, 0, sizeof (fprs));
supply_fprs (regcache, fprs);
}
{
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
- if (!ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL))
+ if (!ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL))
memset (&sprs32, 0, sizeof (sprs32));
supply_sprs32 (regcache, sprs32.pt_iar, sprs32.pt_msr, sprs32.pt_cr,
sprs32.pt_lr, sprs32.pt_ctr, sprs32.pt_xer,
else
{
/* Pre-fetch: some regs may not be in the cache. */
- ptrace32 (PTT_READ_GPRS, tid, (addr_ptr) gprs32, 0, NULL);
+ ptrace32 (PTT_READ_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
fill_gprs32 (regcache, gprs32);
- ptrace32 (PTT_WRITE_GPRS, tid, (addr_ptr) gprs32, 0, NULL);
+ ptrace32 (PTT_WRITE_GPRS, tid, (uintptr_t) gprs32, 0, NULL);
}
}
&& regno < tdep->ppc_fp0_regnum + ppc_num_fprs)))
{
/* Pre-fetch: some regs may not be in the cache. */
- ptrace32 (PTT_READ_FPRS, tid, (addr_ptr) fprs, 0, NULL);
+ ptrace32 (PTT_READ_FPRS, tid, (uintptr_t) fprs, 0, NULL);
fill_fprs (regcache, fprs);
- ptrace32 (PTT_WRITE_FPRS, tid, (addr_ptr) fprs, 0, NULL);
+ ptrace32 (PTT_WRITE_FPRS, tid, (uintptr_t) fprs, 0, NULL);
}
/* Special-purpose registers. */
gdb_assert (sizeof (sprs32.pt_iar) == 4);
/* Pre-fetch: some registers won't be in the cache. */
- ptrace32 (PTT_READ_SPRS, tid, (addr_ptr) &sprs32, 0, NULL);
+ ptrace32 (PTT_READ_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
fill_sprs32 (regcache, &tmp_iar, &tmp_msr, &tmp_cr, &tmp_lr,
&tmp_ctr, &tmp_xer, &tmp_fpscr);
regcache_raw_collect (regcache, tdep->ppc_mq_regnum,
&sprs32.pt_mq);
- ptrace32 (PTT_WRITE_SPRS, tid, (addr_ptr) &sprs32, 0, NULL);
+ ptrace32 (PTT_WRITE_SPRS, tid, (uintptr_t) &sprs32, 0, NULL);
}
}
}
}
}
-/* Attempt a transfer all LEN bytes starting at OFFSET between the
- inferior's OBJECT:ANNEX space and GDB's READBUF/WRITEBUF buffer.
- Return the number of bytes actually transferred. */
+/* Implement the to_xfer_partial target_ops method. */
-static LONGEST
+static enum target_xfer_status
aix_thread_xfer_partial (struct target_ops *ops, enum target_object object,
const char *annex, gdb_byte *readbuf,
const gdb_byte *writebuf,
- ULONGEST offset, LONGEST len)
+ ULONGEST offset, ULONGEST len, ULONGEST *xfered_len)
{
struct cleanup *old_chain = save_inferior_ptid ();
- LONGEST xfer;
+ enum target_xfer_status xfer;
struct target_ops *beneath = find_target_beneath (ops);
inferior_ptid = pid_to_ptid (ptid_get_pid (inferior_ptid));
- xfer = beneath->to_xfer_partial (beneath, object, annex,
- readbuf, writebuf, offset, len);
+ xfer = beneath->to_xfer_partial (beneath, object, annex, readbuf,
+ writebuf, offset, len, xfered_len);
do_cleanups (old_chain);
return xfer;
THREAD, for use in "info threads" output. */
static char *
-aix_thread_extra_thread_info (struct thread_info *thread)
+aix_thread_extra_thread_info (struct target_ops *self,
+ struct thread_info *thread)
{
struct ui_file *buf;
int status;
}
static ptid_t
-aix_thread_get_ada_task_ptid (long lwp, long thread)
+aix_thread_get_ada_task_ptid (struct target_ops *self, long lwp, long thread)
{
return ptid_build (ptid_get_pid (inferior_ptid), 0, thread);
}