diff options
author | José Fonseca <jfonseca@vmware.com> | 2009-03-25 13:44:32 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2009-03-25 21:03:40 +0000 |
commit | ecfa99ece1743769bbdb4371cf57229481993e91 (patch) | |
tree | 7810bd34012233e15f1618be42253845bf7b6eee /src | |
parent | 9d97c3d0be9e57226b6a438a90b71f36e0c99269 (diff) |
python: Use a sequential number to identify each call.
TODO: Modify the trace driver to generate these on the XML file itself.
Diffstat (limited to 'src')
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/model.py | 4 | ||||
-rwxr-xr-x | src/gallium/state_trackers/python/retrace/parser.py | 13 |
2 files changed, 15 insertions, 2 deletions
diff --git a/src/gallium/state_trackers/python/retrace/model.py b/src/gallium/state_trackers/python/retrace/model.py index ae0f4327d7..d4a079fb1e 100755 --- a/src/gallium/state_trackers/python/retrace/model.py +++ b/src/gallium/state_trackers/python/retrace/model.py @@ -101,7 +101,8 @@ class Pointer(Node): class Call: - def __init__(self, klass, method, args, ret): + def __init__(self, no, klass, method, args, ret): + self.no = no self.klass = klass self.method = method self.args = args @@ -187,6 +188,7 @@ class PrettyPrinter: self.formatter.address(node.address) def visit_call(self, node): + self.formatter.text('%s ' % node.no) if node.klass is not None: self.formatter.function(node.klass + '::' + node.method) else: diff --git a/src/gallium/state_trackers/python/retrace/parser.py b/src/gallium/state_trackers/python/retrace/parser.py index db9bcc8226..b0f3e8a432 100755 --- a/src/gallium/state_trackers/python/retrace/parser.py +++ b/src/gallium/state_trackers/python/retrace/parser.py @@ -190,6 +190,10 @@ class XmlParser: class TraceParser(XmlParser): + def __init__(self, fp): + XmlParser.__init__(self, fp) + self.last_call_no = 0 + def parse(self): self.element_start('trace') while self.token.type not in (ELEMENT_END, EOF): @@ -200,6 +204,13 @@ class TraceParser(XmlParser): def parse_call(self): attrs = self.element_start('call') + try: + no = int(attrs['no']) + except KeyError: + self.last_call_no += 1 + no = self.last_call_no + else: + self.last_call_no = no klass = attrs['class'] method = attrs['method'] args = [] @@ -217,7 +228,7 @@ class TraceParser(XmlParser): raise TokenMismatch("<arg ...> or <ret ...>", self.token) self.element_end('call') - return Call(klass, method, args, ret) + return Call(no, klass, method, args, ret) def parse_arg(self): attrs = self.element_start('arg') |