Isaac Sánchez Barrera has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/17488
Change subject: base,python: Fix to allow multiple --debug-ignore values.
......................................................................
base,python: Fix to allow multiple --debug-ignore values.
When adding multiple SimObjects to --debug-ignore, either separating the
values with
a colon or adding multiple --debug-ignore flags, the previous code only
ignored the
last SimObject in the list. This changeset adds and uses new
`ObjectMatch::add` and
`Logger::addIgnore` methods to make the functionality of the flag
consistent with
its description.
Change-Id: Ib6967a48611ea59a211f81af2a970c4de429b1be
Signed-off-by: Isaac Sánchez Barrera <[email protected]>
---
M src/base/match.cc
M src/base/match.hh
M src/base/trace.hh
M src/python/pybind11/debug.cc
4 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/src/base/match.cc b/src/base/match.cc
index dc621b4..a28944f 100644
--- a/src/base/match.cc
+++ b/src/base/match.cc
@@ -44,6 +44,18 @@
}
void
+ObjectMatch::add(ObjectMatch &other)
+{
+ if (!other.tokens.empty()) {
+ tokens.reserve(tokens.size() + other.tokens.size());
+ tokens.insert(tokens.end(),
+ std::make_move_iterator(other.tokens.begin()),
+ std::make_move_iterator(other.tokens.end()));
+ other.tokens.clear();
+ }
+}
+
+void
ObjectMatch::setExpression(const string &expr)
{
tokens.resize(1);
diff --git a/src/base/match.hh b/src/base/match.hh
index 6e1f03b..79d1db2 100644
--- a/src/base/match.hh
+++ b/src/base/match.hh
@@ -47,6 +47,7 @@
public:
ObjectMatch();
ObjectMatch(const std::string &expression);
+ void add(ObjectMatch &other);
void setExpression(const std::string &expression);
void setExpression(const std::vector<std::string> &expression);
bool match(const std::string &name) const
diff --git a/src/base/trace.hh b/src/base/trace.hh
index ddf936e..d1a06fa 100644
--- a/src/base/trace.hh
+++ b/src/base/trace.hh
@@ -86,6 +86,9 @@
/** Set objects to ignore */
void setIgnore(ObjectMatch &ignore_) { ignore = ignore_; }
+ /** Add objects to ignore */
+ void addIgnore(ObjectMatch &ignore_) { ignore.add(ignore_); }
+
virtual ~Logger() { }
};
diff --git a/src/python/pybind11/debug.cc b/src/python/pybind11/debug.cc
index 8fcd0cd..de8b103 100644
--- a/src/python/pybind11/debug.cc
+++ b/src/python/pybind11/debug.cc
@@ -75,7 +75,7 @@
{
ObjectMatch ignore(expr);
- Trace::getDebugLogger()->setIgnore(ignore);
+ Trace::getDebugLogger()->addIgnore(ignore);
}
void
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/17488
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: Ib6967a48611ea59a211f81af2a970c4de429b1be
Gerrit-Change-Number: 17488
Gerrit-PatchSet: 1
Gerrit-Owner: Isaac Sánchez Barrera <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev