[DynInst_API:] [PATCH] dyninstAPI: Stop the process when removing syscalls


Date: Fri, 11 Jul 2014 12:22:51 -0700
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] dyninstAPI: Stop the process when removing syscalls
When detaching from a process, it needs to be stopped to remove syscall
instrumentation.  If it's not already, stop it first and continue after.
---
 dyninstAPI/src/dynProcess.C | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/dyninstAPI/src/dynProcess.C b/dyninstAPI/src/dynProcess.C
index afbbc37ad734..b1de7c7b01fa 100644
--- a/dyninstAPI/src/dynProcess.C
+++ b/dyninstAPI/src/dynProcess.C
@@ -1087,12 +1087,29 @@ bool PCProcess::detachProcess(bool /*cont*/) {
     if( !isAttached() ) return false;
 
     if (tracedSyscalls_) {
+        // Process needs to be stopped to change instrumentation
+        bool needToContinue = false;
+        if( !isStopped() ) {
+            needToContinue = true;
+            if( !stopProcess() ) {
+                proccontrol_printf("%s[%d]: failed to stop process for removing syscalls\n",
+                        FILE__, __LINE__);
+            }
+        }
+
         tracedSyscalls_->removePreFork();
         tracedSyscalls_->removePostFork();
         tracedSyscalls_->removePreExec();
         tracedSyscalls_->removePostExec();
         tracedSyscalls_->removePreExit();
         tracedSyscalls_->removePreLwpExit();
+
+        if( needToContinue ) {
+            if( !continueProcess() ) {
+                proccontrol_printf("%s[%d]: failed to continue process after removing syscalls\n",
+                        FILE__, __LINE__);
+            }
+        }
     }
 
     // TODO figure out if ProcControl should care about continuing a process
-- 
1.9.3

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] dyninstAPI: Stop the process when removing syscalls, Josh Stone <=