diff --git a/sparta/sparta/app/Simulation.hpp b/sparta/sparta/app/Simulation.hpp index fab13b933c..af1143a2a6 100644 --- a/sparta/sparta/app/Simulation.hpp +++ b/sparta/sparta/app/Simulation.hpp @@ -92,8 +92,9 @@ class Simulation * must be made before building/configuring/finalizing. * \param sim_name Name of the simulator * \param scheduler Pointer to the Scheduler that this Simulation operates with + * \param en_backtrace Enable backtrace on error (including SIGSEGV, SIGFPE, SIGILL, SIGABRT, SIGBUS), default is true */ - Simulation(const std::string& sim_name, Scheduler * scheduler); + Simulation(const std::string& sim_name, Scheduler * scheduler, bool en_backtrace=true); /*! * \brief Virtual destructor diff --git a/sparta/src/Simulation.cpp b/sparta/src/Simulation.cpp index 0d5000a802..abb37af78c 100644 --- a/sparta/src/Simulation.cpp +++ b/sparta/src/Simulation.cpp @@ -318,7 +318,8 @@ const DatabaseAccessor * Simulation::getSimulationDatabaseAccessor() const } Simulation::Simulation(const std::string& sim_name, - Scheduler * scheduler) : + Scheduler * scheduler, + bool en_backtrace) : clk_manager_(scheduler), sim_name_(sim_name), scheduler_(scheduler), @@ -335,13 +336,15 @@ Simulation::Simulation(const std::string& sim_name, // Watch for created nodes to which we will apply taps root_.getNodeAttachedNotification().REGISTER_FOR_THIS(rootDescendantAdded_); - // Handle illegal signals. - // Note: Update documentation if these signals are modified - backtrace_.setAsHandler(SIGSEGV); - backtrace_.setAsHandler(SIGFPE); - backtrace_.setAsHandler(SIGILL); - backtrace_.setAsHandler(SIGABRT); - backtrace_.setAsHandler(SIGBUS); + if (en_backtrace) { + // Handle illegal signals. + // Note: Update documentation if these signals are modified + backtrace_.setAsHandler(SIGSEGV); + backtrace_.setAsHandler(SIGFPE); + backtrace_.setAsHandler(SIGILL); + backtrace_.setAsHandler(SIGABRT); + backtrace_.setAsHandler(SIGBUS); + } report_repository_.reset(new sparta::ReportRepository(this));