Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/13307

Change subject: systemc: Use the "catch action" and the handler func outside sc_main.
......................................................................

systemc: Use the "catch action" and the handler func outside sc_main.

If an exception escapes sc_main, Accellera catches it and feeds it
into the report handler, telling it to run the catch actions. This
seems like it sets up lots of dangerous scenarios, and also makes a
vital error detecting path more complex and error prone.

On the other hand, it makes one of the tests pass.

Change-Id: I7f9d07e01e63c7abeee903febe2e434041ec49a4
---
M src/systemc/core/sc_main.cc
M src/systemc/tests/config.py
2 files changed, 7 insertions(+), 3 deletions(-)



diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index 59ec9f8..12e129a 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -78,10 +78,15 @@
                 // after sc_main returns.
             } catch (const sc_report &r) {
                 // There was an exception nobody caught.
-                resultStr = r.what();
+                resultStr = "uncaught sc_report";
+                sc_report_handler::get_handler()(
+                        r, sc_report_handler::get_catch_actions());
             } catch (...) {
                 // There was some other type of exception we need to wrap.
-                resultStr = ::sc_gem5::reportifyException().what();
+                resultStr = "uncaught exception";
+                sc_report_handler::get_handler()(
+                        ::sc_gem5::reportifyException(),
+                        sc_report_handler::get_catch_actions());
             }
             ::sc_gem5::Kernel::scMainFinished(true);
             ::sc_gem5::scheduler.clear();
diff --git a/src/systemc/tests/config.py b/src/systemc/tests/config.py
index d9ae749..79a6338 100755
--- a/src/systemc/tests/config.py
+++ b/src/systemc/tests/config.py
@@ -59,5 +59,4 @@
     # generate errors, and as long as their output matches that's still
     # considered correct. A "real" systemc config should expect sc_main
     # (if present) not to fail.
-    print('\n' + result.message)
     sys.exit(int(result.code))

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13307
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I7f9d07e01e63c7abeee903febe2e434041ec49a4
Gerrit-Change-Number: 13307
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to