diff --git a/libIRDB/include/core/transform_step.h b/libIRDB/include/core/transform_step.h index 5b864c69e0c7e92def7a27e7d6288b68e8ada48c..2dc0c50b4029e7b764629a1a849c08fcb02cfc6f 100644 --- a/libIRDB/include/core/transform_step.h +++ b/libIRDB/include/core/transform_step.h @@ -30,6 +30,6 @@ namespace Transform_SDK } extern "C" -std::unique_ptr<Transform_SDK::TransformStep_t> GetTransformStep(void); +std::shared_ptr<Transform_SDK::TransformStep_t> GetTransformStep(void); #endif diff --git a/libIRDB/test/fill_in_cfg.cpp b/libIRDB/test/fill_in_cfg.cpp index 9ffd312fa8fc7dfed911c626ac5dce7debb32211..554ce87d8ad435afd87dfbe3e386bb86b4844010 100644 --- a/libIRDB/test/fill_in_cfg.cpp +++ b/libIRDB/test/fill_in_cfg.cpp @@ -664,8 +664,8 @@ int PopulateCFG::executeStep(IRDBObjects_t *const irdb_objects) extern "C" -unique_ptr<Transform_SDK::TransformStep_t> GetTransformStep(void) +shared_ptr<Transform_SDK::TransformStep_t> GetTransformStep(void) { - unique_ptr<Transform_SDK::TransformStep_t> the_step(new PopulateCFG()); + shared_ptr<Transform_SDK::TransformStep_t> the_step(new PopulateCFG()); return the_step; } diff --git a/libIRDB/test/fill_in_indtargs.cpp b/libIRDB/test/fill_in_indtargs.cpp index 3faa5599dd353c4c5a5a29e9d9938275e7a7d25a..31917f1730f3a7f54668b394b0ae950067936891 100644 --- a/libIRDB/test/fill_in_indtargs.cpp +++ b/libIRDB/test/fill_in_indtargs.cpp @@ -2869,7 +2869,7 @@ int64_t do_unpin_opt=numeric_limits<int64_t>::max() ; db_id_t variant_id=BaseObj_t::NOT_IN_DATABASE; set<virtual_offset_t> forced_pins; -int ParseArgs(int argc, char* argv[]) +int parseArgs(int argc, const char* const argv[]) { auto argc_iter = (int)2; @@ -2941,7 +2941,7 @@ int ParseArgs(int argc, char* argv[]) } -int ExecuteStep(IRDBObjects_t *irdb_objects) +int executeStep(IRDBObjects_t *const irdb_objects) { //VariantID_t *pidp=nullptr; //FileIR_t * firp=nullptr; @@ -3003,7 +3003,7 @@ int ExecuteStep(IRDBObjects_t *irdb_objects) return 0; } -std::string GetStepName(void) override +std::string getStepName(void) const override { return std::string("fill_in_indtargs"); } @@ -3012,25 +3012,27 @@ std::string GetStepName(void) override }; -PopulateIndTargs_t* curInvocation; +shared_ptr<Transform_SDK::TransformStep_t> curInvocation; bool possible_target(virtual_offset_t p, virtual_offset_t from_addr, ibt_provenance_t prov) { assert(curInvocation); - return curInvocation->possible_target(p,from_addr,prov); + return (dynamic_cast<PopulateIndTargs_t*>(curInvocation.get()))->possible_target(p,from_addr,prov); } void range(virtual_offset_t start, virtual_offset_t end) { assert(curInvocation); - return curInvocation->range(start,end); + return (dynamic_cast<PopulateIndTargs_t*>(curInvocation.get()))->range(start,end); } extern "C" -Transform_SDK::TransformStep_t* GetTransformStep(void) +shared_ptr<Transform_SDK::TransformStep_t> GetTransformStep(void) { - curInvocation=new PopulateIndTargs_t(); + curInvocation.reset(new PopulateIndTargs_t()); return curInvocation; + + //return shared_ptr<Transform_SDK::TransformStep_t>(new PopulateIndTargs_t()); } diff --git a/tools/thanos/thanos.cpp b/tools/thanos/thanos.cpp index 8905aa94062818e22bc23cf7335af84aea7fbaac..7ca7befa09116c5d802963cccaa595ca3d99c51b 100644 --- a/tools/thanos/thanos.cpp +++ b/tools/thanos/thanos.cpp @@ -22,7 +22,7 @@ using namespace Transform_SDK; enum class Mode { DEBUG, VERBOSE, DEFAULT }; int execute_step(int argc, char* argv[], bool step_optional, Mode exec_mode, - IRDBObjects_t* shared_objects, unique_ptr<TransformStep_t>& the_step); + IRDBObjects_t* shared_objects, TransformStep_t* the_step); // The toolchain driver script ps_analyze.sh communicates @@ -163,9 +163,9 @@ int main(int argc, char *argv[]) } else { - unique_ptr<TransformStep_t> (*func)(void); - func = (unique_ptr<TransformStep_t> (*)(void)) sym; - unique_ptr<TransformStep_t> the_step = (*func)(); + shared_ptr<TransformStep_t> (*func)(void); + func = (shared_ptr<TransformStep_t> (*)(void)) sym; + shared_ptr<TransformStep_t> the_step = (*func)(); assert(the_step != NULL); bool step_optional = true; @@ -186,7 +186,7 @@ int main(int argc, char *argv[]) dup2(log_output_fd, STDERR_FILENO); } - int step_retval = execute_step(argc, argv, step_optional, exec_mode, shared_objects, the_step); + int step_retval = execute_step(argc, argv, step_optional, exec_mode, shared_objects, the_step.get()); // cleanup from logging if(exec_mode == Mode::DEFAULT || exec_mode == Mode::VERBOSE) @@ -287,7 +287,7 @@ int main(int argc, char *argv[]) int execute_step(int argc, char* argv[], bool step_optional, Mode exec_mode, - IRDBObjects_t* shared_objects, unique_ptr<TransformStep_t>& the_step) + IRDBObjects_t* shared_objects, TransformStep_t* the_step) { int parse_retval = the_step->parseArgs(argc, argv); if(parse_retval != 0)