Yan Lee has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/70618?usp=email )

Change subject: sim,python: add activate option and method
......................................................................

sim,python: add activate option and method

With --debug-activate option, user can add the target names into
activate list of debug log.

For example, with "--debug-activate=system.AAA.bus --debug-flags=IOXBar"
We can enable the logs of a specified bus.

Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da
---
M src/python/m5/main.py
M src/python/m5/trace.py
M src/python/pybind11/debug.cc
3 files changed, 21 insertions(+), 1 deletion(-)



diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index b4a3472..a68279b 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -276,6 +276,13 @@
         " 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",
         action="append",
@@ -557,6 +564,10 @@

     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 9603914..759f96e 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 313ca81..0087ffa 100644
--- a/src/python/pybind11/debug.cc
+++ b/src/python/pybind11/debug.cc
@@ -68,6 +68,14 @@
 }

 static void
+activate(const char *expr)
+{
+    ObjectMatch activate(expr);
+
+    trace::getDebugLogger()->addActivate(activate);
+}
+
+static void
 ignore(const char *expr)
 {
     ObjectMatch ignore(expr);
@@ -121,6 +129,7 @@
     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)

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

Gerrit-MessageType: newchange
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I89ce87d784ae9736708bbc976a6bad58732bd5da
Gerrit-Change-Number: 70618
Gerrit-PatchSet: 1
Gerrit-Owner: Yan Lee <yan...@google.com>
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org

Reply via email to