diff -r e36d1a8d6ffc -r 9d72fd83da40 src/python/m5/SimObject.py --- a/src/python/m5/SimObject.py Thu Oct 17 11:53:59 2013 -0500 +++ b/src/python/m5/SimObject.py Thu Oct 17 11:54:32 2013 -0500 @@ -784,6 +784,10 @@ self._parent = parent self._name = name + # Return parent object of this SimObject, not implemented by SimObjectVector + def get_parent(self): + return self._parent + # Also implemented by SimObjectVector def get_name(self): return self._name diff -r e36d1a8d6ffc -r 9d72fd83da40 src/python/m5/params.py --- a/src/python/m5/params.py Thu Oct 17 11:53:59 2013 -0500 +++ b/src/python/m5/params.py Thu Oct 17 11:54:32 2013 -0500 @@ -247,6 +247,16 @@ a.append(v.get_config_as_dict()) return a + # If we are replacing an item in the vector, make sure to set the + # parent reference of the new SimObject to be the same as the parent + # of the SimObject being replaced. Useful to have if we created + # a SimObjectVector of temporary objects that will be modified later in + # configuration scripts. + def __setitem__(self, key, value): + val = self[key] + value.set_parent(val.get_parent(), val._name) + super(SimObjectVector, self).__setitem__(key, value) + class VectorParamDesc(ParamDesc): # Convert assigned value to appropriate type. If the RHS is not a # list or tuple, it generates a single-element list.