diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 1d89967b9f432e82d8602a08b91ea7b38dca00e6..2d7d0dd7f808e5611fb7902a73b530a11c9425be 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -76,8 +76,13 @@ class Parser: class ParserStack: def __init__(self, parse_state, arena, top_level_parse): self.parse_state = parse_state + self.parse_state_gdbval = parse_state self.arena = arena - self.top_level_parse = top_level_parse + self.arena_gdbval = arena + # self.parse_state and self.arena is expected to be an int by TopLevelParse and is ultimately used to index into the memory usage dict + # parse_state is set by top_level_parse.first_h_do_parse_after_h_packrat_parse() to be an int + # TODO: remove the redundancy and convert to int when indexing the memory dict? maybe a get_parse_state_address() function? + self.top_level_parse = top_level_parse # To avoid depending on top_level_parse.py self.p_stack = [] self.unclaimed_mem_use = 0 self.partial_alloc_counts = [] @@ -112,6 +117,7 @@ class ParserStack: if self.top_level_parse.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS: #if self.extended_arena_stats_available(): # DEBUG + #import code; code.interact(local=locals()) # DEBUG newbytes = int(self.parse_state['arena']['arena_malloc_bytes']) self.cumulative_byte_differences.insert(0, newbytes - self.bytes_at_enter[-(len(self.cumulative_byte_differences)+1)]) # TODO: consistency. this is the third way of answering the question, "how deep are we in the stack" allocated_bytes = self.cumulative_byte_differences[-len(self.cumulative_byte_differences)] - self.cumulative_byte_differences[-(len(self.cumulative_byte_differences)-1)] # NB: len(self.cumulative_byte_differences) changed since the last line