diff options
author | Miles Kaufmann <milesck@eecs.umich.edu> | 2007-08-30 15:16:59 -0400 |
---|---|---|
committer | Miles Kaufmann <milesck@eecs.umich.edu> | 2007-08-30 15:16:59 -0400 |
commit | eddf6f163741d116235caeba9cec3e604907dfcf (patch) | |
tree | dda7c053781336bb3e4dd819ed246e70e08c29bb /src/python/m5/SimObject.py | |
parent | e4eea9ee04df0183c6d8e23efb3d9c23b47a79de (diff) | |
download | gem5-eddf6f163741d116235caeba9cec3e604907dfcf.tar.xz |
python: Write configuration file without reassigning sys.stdout.
Using print >>ini_file syntax instead of reassigning sys.stdout
allows the python debugger to be used.
--HG--
extra : convert_revision : 63fc268f2e80f338ad1a7abe54b9e979e2239609
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r-- | src/python/m5/SimObject.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index 14978dd75..d3e7d7975 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -721,37 +721,38 @@ class SimObject(object): for child in child_names: self._children[child].unproxy_all() - def print_ini(self): - print '[' + self.path() + ']' # .ini section header + def print_ini(self, ini_file): + print >>ini_file, '[' + self.path() + ']' # .ini section header instanceDict[self.path()] = self if hasattr(self, 'type'): - print 'type=%s' % self.type + print >>ini_file, 'type=%s' % self.type child_names = self._children.keys() child_names.sort() if len(child_names): - print 'children=%s' % ' '.join(child_names) + print >>ini_file, 'children=%s' % ' '.join(child_names) param_names = self._params.keys() param_names.sort() for param in param_names: value = self._values.get(param) if value != None: - print '%s=%s' % (param, self._values[param].ini_str()) + print >>ini_file, '%s=%s' % (param, + self._values[param].ini_str()) port_names = self._ports.keys() port_names.sort() for port_name in port_names: port = self._port_refs.get(port_name, None) if port != None: - print '%s=%s' % (port_name, port.ini_str()) + print >>ini_file, '%s=%s' % (port_name, port.ini_str()) - print # blank line between objects + print >>ini_file # blank line between objects for child in child_names: - self._children[child].print_ini() + self._children[child].print_ini(ini_file) def getCCParams(self): if self._ccParams: |