From 1269a0066d7ca28f1c4e16b02c749d230ed629ab Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Mon, 27 Mar 2023 14:54:48 +0200 Subject: [PATCH] (WIP commit) next try --- gdb-port/parser.py | 4 ++-- gdb-port/top-level-parse.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 2d7d0dd..636cb59 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -97,7 +97,7 @@ class ParserStack: self.partial_alloc_counts.append(None) if self.top_level_parse.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS: #TODO: check that self.arena is same as gdb.selected_frame()'s arena - self.bytes_at_enter.append(int(self.arena['arena_malloc_bytes'])) + self.bytes_at_enter.append(int(self.arena_gdbval['arena_malloc_bytes'])) self.cumulative_byte_differences = [] prev = 0 if len(self.bytes_at_enter) > 1: @@ -118,7 +118,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']) + newbytes = int(self.parse_state_gdbval['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 self.total_byte_differences.insert(-len(self.cumulative_byte_differences), allocated_bytes) diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 5e9d22f..1d22941 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -61,9 +61,10 @@ class TopLevelParse: def enter_h_do_parse(self, parse_state, arena, parser): parser_stack = self.peek_parserstack() if parser_stack.arena is None: - parser_stack.arena = arena + parser_stack.arena_gdbval = arena if parser_stack.parse_state is None: - parser_stack.parse_state = parse_state + parser_stack.parse_state_gdbval = parse_state + # TODO: if we can set things here, first_h_do_parse_after_packrat_parse() may be entirely unnecessary try: parser_obj = self.parser_objs[parser] -- GitLab