From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8450 invoked by alias); 15 Jul 2002 23:34:29 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 8436 invoked from network); 15 Jul 2002 23:34:24 -0000 Received: from unknown (HELO potter.sfbay.redhat.com) (205.180.83.107) by sources.redhat.com with SMTP; 15 Jul 2002 23:34:24 -0000 Received: from romulus.sfbay.redhat.com (IDENT:KFo75Vj2HhOZdyIJ2xph6Og2dh4oH6j7@romulus.sfbay.redhat.com [172.16.27.251]) by potter.sfbay.redhat.com (8.11.6/8.11.6) with ESMTP id g6FNZ1Q17642 for ; Mon, 15 Jul 2002 16:35:02 -0700 Received: (from kev@localhost) by romulus.sfbay.redhat.com (8.11.6/8.11.6) id g6FNYL606347 for gdb-patches@sources.redhat.com; Mon, 15 Jul 2002 16:34:21 -0700 Date: Mon, 15 Jul 2002 17:27:00 -0000 From: Kevin Buettner Message-Id: <1020715233420.ZM6346@localhost.localdomain> To: gdb-patches@sources.redhat.com Subject: [PATCH] aix-thread.c: Eliminate some more macros MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2002-07/txt/msg00344.txt.bz2 * 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); }