Skip to content

Commit

Permalink
Add support for turn on/off backtrace
Browse files Browse the repository at this point in the history
Added option to disable backtrace (conflicts with other framework like SST)
  • Loading branch information
raindroid committed Nov 21, 2024
1 parent a944066 commit 39fc2bd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
3 changes: 2 additions & 1 deletion sparta/sparta/app/Simulation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 11 additions & 8 deletions sparta/src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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));

Expand Down

0 comments on commit 39fc2bd

Please sign in to comment.