summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/systemc/core/sc_main.cc3
-rw-r--r--src/systemc/core/scheduler.cc11
-rw-r--r--src/systemc/core/scheduler.hh4
3 files changed, 8 insertions, 10 deletions
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index e9df6a1e0..59ec9f8bd 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -81,8 +81,7 @@ class ScMainFiber : public Fiber
resultStr = r.what();
} catch (...) {
// There was some other type of exception we need to wrap.
- const sc_report *r = ::sc_gem5::reportifyException();
- resultStr = r->what();
+ resultStr = ::sc_gem5::reportifyException().what();
}
::sc_gem5::Kernel::scMainFinished(true);
::sc_gem5::scheduler.clear();
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index fe1d7c2e4..d57505517 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -418,11 +418,10 @@ Scheduler::schedulePause()
}
void
-Scheduler::throwToScMain(const ::sc_core::sc_report *r)
+Scheduler::throwToScMain()
{
- if (!r)
- r = reportifyException();
- _throwToScMain = r;
+ ::sc_core::sc_report report = reportifyException();
+ _throwToScMain = &report;
status(StatusOther);
scMain->run();
}
@@ -462,7 +461,7 @@ throwingReportHandler(const ::sc_core::sc_report &r,
} // anonymous namespace
-const ::sc_core::sc_report *
+const ::sc_core::sc_report
reportifyException()
{
::sc_core::sc_report_handler_proc old_handler =
@@ -488,7 +487,7 @@ reportifyException()
}
} catch (const ::sc_core::sc_report &r) {
::sc_core::sc_report_handler::set_handler(old_handler);
- return &r;
+ return r;
}
panic("No exception thrown in reportifyException.");
}
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index de9d627c1..83585dd2d 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -365,7 +365,7 @@ class Scheduler
uint64_t changeStamp() { return _changeStamp; }
- void throwToScMain(const ::sc_core::sc_report *r=nullptr);
+ void throwToScMain();
Status status() { return _status; }
void status(Status s) { _status = s; }
@@ -511,7 +511,7 @@ Scheduler::TimeSlot::process()
scheduler.completeTimeSlot(this);
}
-const ::sc_core::sc_report *reportifyException();
+const ::sc_core::sc_report reportifyException();
} // namespace sc_gem5