From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] aix-thread.c: Eliminate some more macros
Date: Mon, 15 Jul 2002 17:27:00 -0000 [thread overview]
Message-ID: <1020715233420.ZM6346@localhost.localdomain> (raw)
* aix-thread.c (PD_ERROR, CALL_BASE): Delete.
(ops_resume, ops_wait, fetch_regs_lib, store_regs_lib)
(ops_xfer_memory, ops_kill): Don't use PD_ERROR or CALL_BASE
macros.
Index: aix-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/aix-thread.c,v
retrieving revision 1.3
diff -u -p -r1.3 aix-thread.c
--- aix-thread.c 15 Jul 2002 20:06:12 -0000 1.3
+++ aix-thread.c 15 Jul 2002 22:49:26 -0000
@@ -81,12 +81,6 @@ static int debug_aix_thread;
/* 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. */
@@ -97,17 +91,6 @@ static int debug_aix_thread;
#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 {
@@ -934,7 +917,12 @@ ops_resume (ptid_t ptid, int step, enum
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);
@@ -960,8 +948,14 @@ ops_resume (ptid_t ptid, int step, enum
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);
@@ -1051,7 +1045,8 @@ fetch_regs_lib (pthdb_pthread_t pdtid)
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. */
@@ -1209,7 +1204,8 @@ store_regs_lib (pthdb_pthread_t pdtid)
/* 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. */
@@ -1227,7 +1223,8 @@ store_regs_lib (pthdb_pthread_t pdtid)
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
@@ -1340,9 +1337,12 @@ ops_xfer_memory (CORE_ADDR memaddr, char
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;
}
@@ -1351,7 +1351,11 @@ ops_xfer_memory (CORE_ADDR memaddr, char
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);
}
reply other threads:[~2002-07-15 23:34 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1020715233420.ZM6346@localhost.localdomain \
--to=kevinb@redhat.com \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox