From fd7d3ca2c903f016398c4f741a91bafc9dd8376e Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Sun, 14 May 2023 21:42:27 +0200 Subject: [PATCH] (WIP) Workaround for AttributeError An allocation of 0 gets attributed to a parser of address 0. --- gdb-port/parser.py | 1 + gdb-port/top-level-parse.py | 2 ++ 2 files changed, 3 insertions(+) diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 5c10d08..00b79ca 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -359,6 +359,7 @@ class ParserStack: #print("commit_at_push: push_allocs:", push_allocs) # DEBUG # Most recent event is a push event, and we have no information on its allocations yet. So we only increment self.committed up to the index of the previous event + self.unclaimed_mem_use += push_allocs.pop(0,0) self.committed = len(self.stack_events)-2 #print("commit_at_push: self.committed after update:", self.committed) # DEBUG # TODO: do we want to increment mem use in commit_at_*, or do we want to return the dict and have it taken care of by push()/pop()? diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 77e553f..d9e62fb 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -276,6 +276,8 @@ class TopLevelParse: for ps in self.parser_stacks: new_allocs_by_parser = ps.get_pending_allocations() for parser, alloc in new_allocs_by_parser.items(): + if not parser: # DEBUG + continue # DEBUG pending_allocs = self.pending_allocs.get(parser, {}) pending_allocs[ps.arena_int] = pending_allocs.get(ps.arena_int, 0) + alloc.get(ps.arena_int, 0) self.pending_allocs[parser] = pending_allocs -- GitLab