diff --git a/src/python/m5/main.py b/src/python/m5/main.py index b4a3472187..a68279b633 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -275,6 +275,13 @@ def parse_options(): help="Sets the output file for debug. Append '.gz' to the name for it" " to be compressed automatically [Default: %default]", ) + option( + "--debug-activate", + metavar="EXPR[,EXPR]", + action="append", + split=",", + help="Activate EXPR sim objects", + ) option( "--debug-ignore", metavar="EXPR", @@ -557,6 +564,10 @@ def main(): trace.output(options.debug_file) + for activate in options.debug_activate: + _check_tracing() + trace.activate(activate) + for ignore in options.debug_ignore: _check_tracing() trace.ignore(ignore) diff --git a/src/python/m5/trace.py b/src/python/m5/trace.py index 9603914ca8..759f96e5bf 100644 --- a/src/python/m5/trace.py +++ b/src/python/m5/trace.py @@ -25,4 +25,4 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Export native methods to Python -from _m5.trace import output, ignore, disable, enable +from _m5.trace import output, activate, ignore, disable, enable diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc index 313ca81e6e..0087ffadd4 100644 --- a/src/python/pybind11/debug.cc +++ b/src/python/pybind11/debug.cc @@ -67,6 +67,14 @@ output(const char *filename) trace::setDebugLogger(new trace::OstreamLogger(*file_stream->stream())); } +static void +activate(const char *expr) +{ + ObjectMatch activate(expr); + + trace::getDebugLogger()->addActivate(activate); +} + static void ignore(const char *expr) { @@ -121,6 +129,7 @@ pybind_init_debug(py::module_ &m_native) py::module_ m_trace = m_native.def_submodule("trace"); m_trace .def("output", &output) + .def("activate", &activate) .def("ignore", &ignore) .def("enable", &trace::enable) .def("disable", &trace::disable)