summaryrefslogtreecommitdiff
path: root/src/python/m5
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2017-09-25 16:17:24 -0700
committerGabe Black <gabeblack@google.com>2017-09-26 23:47:06 +0000
commit765c0bb6b3d771f3a9997ff772c9e03525e3bee1 (patch)
treeec857123f04018c3acf99b9daf9ef18e7acc5750 /src/python/m5
parent3734637c0c41eedc5b5dc4f1ced50610a7a17db4 (diff)
downloadgem5-765c0bb6b3d771f3a9997ff772c9e03525e3bee1.tar.xz
sim: Don't add the NULL SimObject as a child of other SimObjects.
Change-Id: Ibdc48af8e5a461077f75d781cfd8191586c54115 Reviewed-on: https://gem5-review.googlesource.com/4846 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/python/m5')
-rw-r--r--src/python/m5/SimObject.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index baeef73d9..cff818c66 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -579,7 +579,8 @@ class MetaSimObject(type):
# object is not an orphan and can provide better error
# messages.
child.set_parent(cls, name)
- cls._children[name] = child
+ if not isNullPointer(child):
+ cls._children[name] = child
def _new_port(cls, name, port):
# each port should be uniquely assigned to one variable
@@ -1226,7 +1227,8 @@ class SimObject(object):
# exercised without specialized testing.
self.clear_child(name)
child.set_parent(self, name)
- self._children[name] = child
+ if not isNullPointer(child):
+ self._children[name] = child
# Take SimObject-valued parameters that haven't been explicitly
# assigned as children and make them children of the object that