Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for turning off signal handler that prints backtrace #543

Merged
merged 4 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions sparta/src/Simulation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,14 +335,6 @@ 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);

report_repository_.reset(new sparta::ReportRepository(this));

// Sanity check - simulations cannot exist without a scheduler
Expand Down Expand Up @@ -486,6 +478,16 @@ void Simulation::configure(const int argc,
throw SpartaException("Logging ennoblement is currently not supported with debug-roi. Use --debug or --debug-on-icount");
}

if (SimulationConfiguration::SignalMode::ENABLE_BACKTRACE_SIGNALS == sim_config_->signal_mode) {
// 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 there are nodes already existing in the tree (e.g. root or "") then
// there are no notifications for these TreeNodes since they already exist.
// Install taps immediately instead of through rootDescendantAdded_
Expand Down
Loading