/* Build and lwp ptid. */
#define BUILD_LWP(LWP, PID) MERGEPID (PID, LWP)
-/* Call error() with a message indicating that libpthdebug FUNC failed with
- STATUS. */
-
-#define PD_ERROR(func, status) \
- error ("aix-thread: %s returned %s", func, pd_status2str (status))
-
/* pthdb_user_t value that we pass to pthdb functions. 0 causes
PTHDB_BAD_USER errors, so use 1. */
#define PDC_SUCCESS PTHDB_SUCCESS
#define PDC_FAILURE PTHDB_CALLBACK
-/* Convert composite process/thread inferior_ptid to a process id, evaluate
- base_ops function CALL, and then restore inferior_ptid. */
-
-#define CALL_BASE(call) \
- do { \
- struct cleanup *cleanup = save_inferior_ptid (); \
- inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid)); \
- call; \
- do_cleanups (cleanup); \
- } while (0)
-
/* Private data attached to each element in GDB's thread list. */
struct private_thread_info {
pthdb_tid_t tid[2];
if (!PD_TID (ptid))
- CALL_BASE (base_ops.to_resume (ptid, step, sig));
+ {
+ struct cleanup *cleanup = save_inferior_ptid ();
+ inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
+ base_ops.to_resume (ptid, step, sig);
+ do_cleanups (cleanup);
+ }
else
{
thread = find_thread_pid (ptid);
static ptid_t
ops_wait (ptid_t ptid, struct target_waitstatus *status)
{
+ struct cleanup *cleanup = save_inferior_ptid ();
+
pid_to_prc (&ptid);
- CALL_BASE (ptid = base_ops.to_wait (ptid, status));
+
+ inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
+ ptid = base_ops.to_wait (ptid, status);
+ do_cleanups (cleanup);
+
if (PIDGET (ptid) == -1)
return pid_to_ptid (-1);
fprintf_unfiltered (gdb_stdlog, "fetch_regs_lib %lx\n", (long)pdtid);
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- PD_ERROR ("fetch_registers: pthdb_pthread_context", status);
+ error ("aix-thread: fetch_registers: pthdb_pthread_context returned %s",
+ pd_status2str (status));
/* General-purpose registers. */
/* Retrieve the thread's current context for its non-register values. */
status = pthdb_pthread_context (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- PD_ERROR ("store_registers: pthdb_pthread_context", status);
+ error ("aix-thread: store_registers: pthdb_pthread_context returned %s",
+ pd_status2str (status));
/* General-purpose registers. */
status = pthdb_pthread_setcontext (pd_session, pdtid, &ctx);
if (status != PTHDB_SUCCESS)
- PD_ERROR ("store_registers: pthdb_pthread_setcontext", status);
+ error ("aix-thread: store_registers: pthdb_pthread_setcontext returned %s",
+ pd_status2str (status));
}
/* Store register REGNO if != -1 or all registers otherwise into kernel
struct target_ops *target)
{
int n;
+ struct cleanup *cleanup = save_inferior_ptid ();
+
+ inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
+ n = base_ops.to_xfer_memory (memaddr, myaddr, len, write, attrib, &base_ops);
+ do_cleanups (cleanup);
- CALL_BASE (n = base_ops.to_xfer_memory (memaddr, myaddr, len, write,
- attrib, &base_ops));
return n;
}
static void
ops_kill (void)
{
- CALL_BASE (base_ops.to_kill ());
+ struct cleanup *cleanup = save_inferior_ptid ();
+
+ inferior_ptid = pid_to_ptid (PIDGET (inferior_ptid));
+ base_ops.to_kill ();
+ do_cleanups (cleanup);
}
/* Clean up after the inferior exits. */