[DynInst_API:] [PATCH] dyninstAPI: Squash library callbacks during exec bootstrap


Date: Wed, 26 Feb 2014 14:06:21 -0800
From: Josh Stone <jistone@xxxxxxxxxx>
Subject: [DynInst_API:] [PATCH] dyninstAPI: Squash library callbacks during exec bootstrap
When a process execs and the underlying PCProcess changes, there's
nothing that BPatch or the user can reasonably do with library
callbacks on the old process, so squash them.  Once the PCProcess gets
updated in BPatch::registerExecExit, callbacks will resume as normal.
---
 dyninstAPI/src/BPatch.C | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/dyninstAPI/src/BPatch.C b/dyninstAPI/src/BPatch.C
index 3b187ed5b628..ef03be167ede 100644
--- a/dyninstAPI/src/BPatch.C
+++ b/dyninstAPI/src/BPatch.C
@@ -948,6 +948,10 @@ void BPatch::registerLoadedModule(PCProcess *process, mapped_module *mod) {
 
     BPatch_process *bProc = BPatch::bpatch->getProcessByPid(process->getPid());
     if (!bProc) return; // Done
+
+    // Squash this notification if the PCProcess has changed (e.g. during exec)
+    if (bProc->llproc != process) return;
+
     BPatch_image *bImage = bProc->getImage();
     assert(bImage); // This we can assert to be true
     
@@ -968,6 +972,10 @@ void BPatch::registerUnloadedModule(PCProcess *process, mapped_module *mod) {
 
     BPatch_process *bProc = BPatch::bpatch->getProcessByPid(process->getPid());
     if (!bProc) return; // Done
+
+    // Squash this notification if the PCProcess has changed (e.g. during exec)
+    if (bProc->llproc != process) return;
+
     BPatch_image *bImage = bProc->getImage();
     if (!bImage) { // we got an event during process startup
         return;
-- 
1.8.5.3

[← Prev in Thread] Current Thread [Next in Thread→]
  • [DynInst_API:] [PATCH] dyninstAPI: Squash library callbacks during exec bootstrap, Josh Stone <=