/* Low level interface for debugging AIX 4.3+ pthreads.
- Copyright (C) 1999-2015 Free Software Foundation, Inc.
+ Copyright (C) 1999-2017 Free Software Foundation, Inc.
Written by Nick Duffek <nsd@redhat.com>.
This file is part of GDB.
"pdc_read_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
user, (long) buf, hex_string (addr), len);
- status = target_read_memory (addr, buf, len);
+ status = target_read_memory (addr, (gdb_byte *) buf, len);
ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
if (debug_aix_thread)
"pdc_write_data (user = %ld, buf = 0x%lx, addr = %s, len = %ld)\n",
user, (long) buf, hex_string (addr), len);
- status = target_write_memory (addr, buf, len);
+ status = target_write_memory (addr, (gdb_byte *) buf, len);
ret = status == 0 ? PDC_SUCCESS : PDC_FAILURE;
if (debug_aix_thread)
if (arch64)
ptrace64aix (PTT_CONTINUE, tid[0], (long long) 1,
- gdb_signal_to_host (sig), (void *) tid);
+ gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
else
ptrace32 (PTT_CONTINUE, tid[0], (addr_ptr) 1,
- gdb_signal_to_host (sig), (void *) tid);
+ gdb_signal_to_host (sig), (PTRACE_TYPE_ARG5) tid);
}
}
}
}
-/* Fetch register REGNO if != -1 or all registers otherwise in the
- thread/process specified by inferior_ptid. */
+/* Fetch register REGNO if != -1 or all registers otherwise from the
+ thread/process connected to REGCACHE. */
static void
aix_thread_fetch_registers (struct target_ops *ops,
pthdb_tid_t tid;
struct target_ops *beneath = find_target_beneath (ops);
- if (!PD_TID (inferior_ptid))
+ if (!PD_TID (regcache_get_ptid (regcache)))
beneath->to_fetch_registers (beneath, regcache, regno);
else
{
- thread = find_thread_ptid (inferior_ptid);
+ thread = find_thread_ptid (regcache_get_ptid (regcache));
tid = thread->priv->tid;
if (tid == PTHDB_INVALID_TID)
}
/* Store gdb's current view of the register set into the
- thread/process specified by inferior_ptid. */
+ thread/process connected to REGCACHE. */
static void
aix_thread_store_registers (struct target_ops *ops,
pthdb_tid_t tid;
struct target_ops *beneath = find_target_beneath (ops);
- if (!PD_TID (inferior_ptid))
+ if (!PD_TID (regcache_get_ptid (regcache)))
beneath->to_store_registers (beneath, regcache, regno);
else
{
- thread = find_thread_ptid (inferior_ptid);
+ thread = find_thread_ptid (regcache_get_ptid (regcache));
tid = thread->priv->tid;
if (tid == PTHDB_INVALID_TID)
aix_thread_extra_thread_info (struct target_ops *self,
struct thread_info *thread)
{
- struct ui_file *buf;
int status;
pthdb_pthread_t pdtid;
pthdb_tid_t tid;
if (!PD_TID (thread->ptid))
return NULL;
- buf = mem_fileopen ();
+ string_file buf;
pdtid = thread->priv->pdtid;
tid = thread->priv->tid;
if (tid != PTHDB_INVALID_TID)
/* i18n: Like "thread-identifier %d, [state] running, suspended" */
- fprintf_unfiltered (buf, _("tid %d"), (int)tid);
+ buf.printf (_("tid %d"), (int)tid);
status = pthdb_pthread_state (pd_session, pdtid, &state);
if (status != PTHDB_SUCCESS)
state = PST_NOTSUP;
- fprintf_unfiltered (buf, ", %s", state2str (state));
+ buf.printf (", %s", state2str (state));
status = pthdb_pthread_suspendstate (pd_session, pdtid,
&suspendstate);
if (status == PTHDB_SUCCESS && suspendstate == PSS_SUSPENDED)
/* i18n: Like "Thread-Id %d, [state] running, suspended" */
- fprintf_unfiltered (buf, _(", suspended"));
+ buf.printf (_(", suspended"));
status = pthdb_pthread_detachstate (pd_session, pdtid,
&detachstate);
if (status == PTHDB_SUCCESS && detachstate == PDS_DETACHED)
/* i18n: Like "Thread-Id %d, [state] running, detached" */
- fprintf_unfiltered (buf, _(", detached"));
+ buf.printf (_(", detached"));
pthdb_pthread_cancelpend (pd_session, pdtid, &cancelpend);
if (status == PTHDB_SUCCESS && cancelpend)
/* i18n: Like "Thread-Id %d, [state] running, cancel pending" */
- fprintf_unfiltered (buf, _(", cancel pending"));
+ buf.printf (_(", cancel pending"));
- ui_file_write (buf, "", 1);
+ buf.write ("", 1);
xfree (ret); /* Free old buffer. */
- ret = ui_file_xstrdup (buf, NULL);
- ui_file_delete (buf);
+ ret = xstrdup (buf.c_str ());
return ret;
}