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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/70618 Reviewed-by: Bobby Bruce <bbruce@ucdavis.edu> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Jason Lowe-Power <power.jg@gmail.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user