std::vector<BPatch_snippet*> registers; // PC + DWARF registers
+ // disable implicit constructors by not implementing these
+ mutatee (const mutatee& other);
+ mutatee& operator= (const mutatee& other);
+
public:
mutatee(BPatch_process* process);
~mutatee() {}
mutator::~mutator ()
{
+ mutatees.clear();
+
if (module)
{
dlclose(module);
return false;
}
- mutatees.push_back(mutatee(app));
- if (!mutatees.back().load_stap_dso(module_name))
+ boost::shared_ptr<mutatee> m(new mutatee(app));
+ mutatees.push_back(m);
+
+ if (!m->load_stap_dso(module_name))
return false;
if (!targets.empty())
- mutatees.back().instrument_dynprobes(targets);
+ m->instrument_dynprobes(targets);
return true;
}
// children for continuation and exit status.
// Get the stap module ready...
- mutatees[0].call_function("stp_dyninst_session_init");
+ mutatees[0]->call_function("stp_dyninst_session_init");
// And away we go!
- mutatees[0].continue_execution();
- while (!mutatees[0].is_terminated())
+ mutatees[0]->continue_execution();
+ while (!mutatees[0]->is_terminated())
patch.waitForStatusChange();
// When we get process detaching (rather than just exiting), need:
- // mutatees[0].call_function("stp_dyninst_session_exit");
+ // mutatees[0]->call_function("stp_dyninst_session_exit");
- return mutatees[0].check_exit();
+ return mutatees[0]->check_exit();
}
BPatch_process* process = thread->getProcess();
for (size_t i = 0; i < mutatees.size(); ++i)
- if (mutatees[i] == process)
- mutatees[i].instrument_object_dynprobes(module->getObject(), targets);
+ if (*mutatees[i] == process)
+ mutatees[i]->instrument_object_dynprobes(module->getObject(), targets);
}
#include <string>
#include <vector>
+#include <boost/shared_ptr.hpp>
+
#include <BPatch.h>
#include <BPatch_module.h>
#include <BPatch_process.h>
std::string module_name; // the filename of the probe module
std::vector<dynprobe_target> targets; // the probe targets in the module
- std::vector<mutatee> mutatees; // all attached target processes
+ std::vector<boost::shared_ptr<mutatee> > mutatees; // all attached target processes
// disable implicit constructors by not implementing these
mutator (const mutator& other);