sc_main.cc (13301:0ef9dd4e1154) sc_main.cc (13312:a7685ffbead8)
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 27 unchanged lines hidden (view full) ---

36#include "sim/core.hh"
37#include "sim/eventq.hh"
38#include "sim/init.hh"
39#include "systemc/core/kernel.hh"
40#include "systemc/core/python.hh"
41#include "systemc/core/scheduler.hh"
42#include "systemc/ext/core/sc_main.hh"
43#include "systemc/ext/utils/sc_report_handler.hh"
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright

--- 27 unchanged lines hidden (view full) ---

36#include "sim/core.hh"
37#include "sim/eventq.hh"
38#include "sim/init.hh"
39#include "systemc/core/kernel.hh"
40#include "systemc/core/python.hh"
41#include "systemc/core/scheduler.hh"
42#include "systemc/ext/core/sc_main.hh"
43#include "systemc/ext/utils/sc_report_handler.hh"
44#include "systemc/utils/report.hh"
44
45// A weak symbol to detect if sc_main has been defined, and if so where it is.
46[[gnu::weak]] int sc_main(int argc, char *argv[]);
47
48namespace sc_core
49{
50
51namespace

--- 22 unchanged lines hidden (view full) ---

74 resultStr = "sc_main returned non-zero";
75 else
76 resultStr = "sc_main finished";
77 // Make sure no systemc events/notifications are scheduled
78 // after sc_main returns.
79 } catch (const sc_report &r) {
80 // There was an exception nobody caught.
81 resultStr = "uncaught sc_report";
45
46// A weak symbol to detect if sc_main has been defined, and if so where it is.
47[[gnu::weak]] int sc_main(int argc, char *argv[]);
48
49namespace sc_core
50{
51
52namespace

--- 22 unchanged lines hidden (view full) ---

75 resultStr = "sc_main returned non-zero";
76 else
77 resultStr = "sc_main finished";
78 // Make sure no systemc events/notifications are scheduled
79 // after sc_main returns.
80 } catch (const sc_report &r) {
81 // There was an exception nobody caught.
82 resultStr = "uncaught sc_report";
82 sc_report_handler::get_handler()(
83 sc_gem5::reportHandlerProc(
83 r, sc_report_handler::get_catch_actions());
84 } catch (...) {
85 // There was some other type of exception we need to wrap.
86 resultStr = "uncaught exception";
84 r, sc_report_handler::get_catch_actions());
85 } catch (...) {
86 // There was some other type of exception we need to wrap.
87 resultStr = "uncaught exception";
87 sc_report_handler::get_handler()(
88 sc_gem5::reportHandlerProc(
88 ::sc_gem5::reportifyException(),
89 sc_report_handler::get_catch_actions());
90 }
91 ::sc_gem5::Kernel::scMainFinished(true);
92 ::sc_gem5::scheduler.clear();
93 } else {
94 // If python tries to call sc_main but no sc_main was defined...
95 fatal("sc_main called but not defined.\n");

--- 270 unchanged lines hidden ---
89 ::sc_gem5::reportifyException(),
90 sc_report_handler::get_catch_actions());
91 }
92 ::sc_gem5::Kernel::scMainFinished(true);
93 ::sc_gem5::scheduler.clear();
94 } else {
95 // If python tries to call sc_main but no sc_main was defined...
96 fatal("sc_main called but not defined.\n");

--- 270 unchanged lines hidden ---