Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints.dot @@ -19,6 +19,7 @@ "program_state": { "store": null, "environment": null, + "dynamic_types": null, "constraints": [ { "symbol": "reg_$0", "range": "{ [0, 0] }" } ] Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints_diff.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints_diff.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/constraints_diff.dot @@ -12,6 +12,7 @@ "program_state": { "store": null, "environment": null, + "dynamic_types": null, "constraints": [ { "symbol": "reg_$0", "range": "{ [0, 10] }" } ] @@ -41,6 +42,7 @@ "program_state": { "store": null, "environment": null, + "dynamic_types": null, "constraints": [ { "symbol": "reg_$0", "range": "{ [0, 5] }" } ] @@ -59,7 +61,8 @@ "program_state": { "store": null, "environment": null, - "constraints": null + "constraints": null, + "dynamic_types": null } } \l}"]; Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/environment.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/environment.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/environment.dot @@ -34,6 +34,7 @@ "program_state": { "store": null, "constraints": null, + "dynamic_types": null, "environment": { "pointer": "0x2", "items": [ Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/environment_diff.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/environment_diff.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/environment_diff.dot @@ -13,6 +13,7 @@ "program_state": { "store": null, "constraints": null, + "dynamic_types": null, "environment": { "pointer": "0x2", "items": [ @@ -59,6 +60,7 @@ "program_state": { "store": null, "constraints": null, + "dynamic_types": null, "environment": { "pointer": "0x2", "items": [ @@ -99,6 +101,7 @@ "program_state": { "store": null, "constraints": null, + "dynamic_types": null, "environment": { "pointer": "0x2", "items": [ Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/store.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/store.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/store.dot @@ -29,6 +29,7 @@ "program_state": { "environment": null, "constraints": null, + "dynamic_types": null, "store": { "pointer": "0x2", "items": [ Index: cfe/trunk/test/Analysis/exploded-graph-rewriter/store_diff.dot =================================================================== --- cfe/trunk/test/Analysis/exploded-graph-rewriter/store_diff.dot +++ cfe/trunk/test/Analysis/exploded-graph-rewriter/store_diff.dot @@ -12,6 +12,7 @@ "program_state": { "environment": null, "constraints": null, + "dynamic_types": null, "store": { "pointer": "0x2", "items": [ @@ -57,6 +58,7 @@ "program_state": { "environment": null, "constraints": null, + "dynamic_types": null, "store": { "pointer": "0x5", "items": [ Index: cfe/trunk/utils/analyzer/exploded-graph-rewriter.py =================================================================== --- cfe/trunk/utils/analyzer/exploded-graph-rewriter.py +++ cfe/trunk/utils/analyzer/exploded-graph-rewriter.py @@ -27,8 +27,8 @@ # Represents any program state trait that is a dictionary of key-value pairs. class GenericMap(object): - def __init__(self, generic_map): - self.generic_map = generic_map + def __init__(self, items): + self.generic_map = collections.OrderedDict(items) def diff(self, prev): return diff_dicts(self.generic_map, prev.generic_map) @@ -218,11 +218,17 @@ if json_ps['store'] is not None else None self.environment = Environment(json_ps['environment']) \ if json_ps['environment'] is not None else None - self.constraints = GenericMap(collections.OrderedDict([ + self.constraints = GenericMap([ (c['symbol'], c['range']) for c in json_ps['constraints'] - ])) if json_ps['constraints'] is not None else None + ]) if json_ps['constraints'] is not None else None + self.dynamic_types = GenericMap([ + (t['region'], '%s%s' % (t['dyn_type'], + ' (or a sub-class)' + if t['sub_classable'] else '')) + for t in json_ps['dynamic_types']]) \ + if json_ps['dynamic_types'] is not None else None + # TODO: Objects under construction. - # TODO: Dynamic types of objects. # TODO: Checker messages. @@ -435,8 +441,7 @@ self._dump('') def visit_environment_in_state(self, s, prev_s=None): - self._dump('' - 'Environment: ') + self._dump('
Environment: ') if s.environment is None: self._dump(' Nothing!') else: @@ -491,7 +496,7 @@ self._dump('') def visit_store_in_state(self, s, prev_s=None): - self._dump('Store: ') + self._dump('
Store: ') if s.store is None: self._dump(' Nothing!') else: @@ -528,16 +533,19 @@ self._dump('') - def visit_generic_map_in_state(self, selector, s, prev_s=None): - self._dump('' - 'Ranges: ') + def visit_generic_map_in_state(self, selector, title, s, prev_s=None): m = getattr(s, selector) + prev_m = getattr(prev_s, selector) if prev_s is not None else None + if m is None and prev_m is None: + return + + self._dump('
') + self._dump('' + '%s: ' % title) if m is None: self._dump(' Nothing!') else: - prev_m = None if prev_s is not None: - prev_m = getattr(prev_s, selector) if prev_m is not None: if m.is_different(prev_m): self._dump('') @@ -551,10 +559,11 @@ def visit_state(self, s, prev_s): self.visit_store_in_state(s, prev_s) - self._dump('
') self.visit_environment_in_state(s, prev_s) - self._dump('
') - self.visit_generic_map_in_state('constraints', s, prev_s) + self.visit_generic_map_in_state('constraints', 'Ranges', + s, prev_s) + self.visit_generic_map_in_state('dynamic_types', 'Dynamic Types', + s, prev_s) def visit_node(self, node): self._dump('%s [shape=record,label=<' @@ -576,7 +585,6 @@ self._dump('
') if node.state is not None: - self._dump('
') prev_s = None # Do diffs only when we have a unique predecessor. # Don't do diffs on the leaf nodes because they're