python: Add error for creating abstact SimObjects
Currently, if you try to instantiate an abstract SimObject the error is confusing and unhelpful. "TypeError: _m5.param_<type>.<type>Params: No constructor defined!" Now, it will instead say "Cannot instantiate an abstract SimObject" and include the name of the object that causes the error. Change-Id: Ia8c51e29dccd999ec90dcd39710cc91d9a5fb86f Signed-off-by: Jason Lowe-Power <jason@lowepower.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/59049 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Maintainer: Andreas Sandberg <andreas.sandberg@arm.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Jason Lowe-Power
parent
7f25e7acbf
commit
1e9db5b9cf
@@ -1175,6 +1175,8 @@ class SimObject(object, metaclass=MetaSimObject):
|
||||
|
||||
# Call C++ to create C++ object corresponding to this object
|
||||
def createCCObject(self):
|
||||
if self.abstract:
|
||||
fatal(f"Cannot instantiate an abstract SimObject ({self.path()})")
|
||||
self.getCCParams()
|
||||
self.getCCObject() # force creation
|
||||
|
||||
|
||||
Reference in New Issue
Block a user