From 516a6ff6dd44292d7ef5f7527b7df6952c95e9cc Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Sat, 13 May 2023 18:41:19 +0200 Subject: [PATCH] Update gather_allocations_in_parser_stacks() (WIP) ParserStack.pending_allocs is now a dictionary of dictionaries with ps.arena as the top level key --- gdb-port/top-level-parse.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 8b3dd9e..73d78a5 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -271,8 +271,12 @@ class TopLevelParse: pending_allocs_by_arena = {} for ps in self.parser_stacks: - allocs = ps.get_pending_allocations() - #pending_allocs_by_arena[ps.arena] = { ps.arena : ps.get_pending_allocations() } + new_allocs_by_arena = ps.get_pending_allocations() + new_allocs = new_allocs_by_arena.get(ps.arena_int, {}) + pending_allocs = self.pending_allocs.get(ps.arena_int, {}) + for addr, alloc in new_allocs: + pending_allocs[addr] = pending_allocs.get(addr, 0) + alloc + pending_allocs_by_arena[ps.arena_int] = pending_allocs # TODO: allocations are grouped by arena, then parser address. we get the arena address from the parser stack, which may be shared between parser stacks # Therefore, it can't just be blindly assigned to a key with the arena's address. the two dicts need to be merged, with the values of duplicate entries added together -- GitLab