Jason Lowe-Power has submitted this change. (
https://gem5-review.googlesource.com/c/public/gem5/+/51787 )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the
submitted one.
)Change subject: python: Updates to improve debugging output
......................................................................
python: Updates to improve debugging output
This changeset updates SimObject and Proxy so that certain errors are
easier to diagnose. In SimObject, the warn() statement could cause
another exception, so it's split into two statements. In Proxy, it is
helpful to know which attribute is referenced when there's a mistake.
Change-Id: I3704a247b8b40e18ffc5e4a6241a74829313c07e
Signed-off-by: Jason Lowe-Power <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/51787
Maintainer: Bobby R. Bruce <[email protected]>
Maintainer: Andreas Sandberg <[email protected]>
Reviewed-by: Andreas Sandberg <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/m5/proxy.py
M src/python/m5/SimObject.py
2 files changed, 24 insertions(+), 3 deletions(-)
Approvals:
Andreas Sandberg: Looks good to me, approved; Looks good to me, approved
Bobby R. Bruce: Looks good to me, approved
kokoro: Regressions pass
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index bf5ab54..25bb003 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -1534,9 +1534,9 @@
def add_child(self, name, child):
child = coerceSimObjectOrVector(child)
if child.has_parent():
- warn(f"{self}.{name} already has parent (Previously declared
as "
- f"{child._parent}.{name}), not resetting parent.\n"
+ warn(f"{self}.{name} already has parent not resetting
parent.\n"
f"\tNote: {name} is not a parameter of
{type(self).__name__}")
+ warn(f"(Previously declared as {child._parent}.{name}")
return
if name in self._children:
# This code path had an undiscovered bug that would make it
fail
diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index fe4cb65..2de0ee7 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -172,7 +172,8 @@
if attr.startswith('_'):
return super(AttrProxy, self).__getattr__(self, attr)
if hasattr(self, '_pdesc'):
- raise AttributeError("Attribute reference on bound proxy")
+ raise AttributeError("Attribute reference on bound proxy "
+ f"({self}.{attr})")
# Return a copy of self rather than modifying self in place
# since self could be an indirect reference via a variable or
# parameter
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/51787
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I3704a247b8b40e18ffc5e4a6241a74829313c07e
Gerrit-Change-Number: 51787
Gerrit-PatchSet: 3
Gerrit-Owner: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s