From 36a2ee294e40a23d976c61479b2d9676ae783d98 Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Thu, 13 Apr 2023 16:50:46 +0200 Subject: [PATCH] Important note about stack event semantics --- gdb-port/parser.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 7db9afb..3d25e67 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -312,9 +312,9 @@ class ParserStack: # - While a "pop" will always have a corresponding "push" event, there may be runs of "push" events # - "pop"s will always increment self.committed, and any "push" MAY increment self.committed # - In terms of parentheses, assuming an intact execution flow, there will never be a stray right parenthesis, but there may be an arbitrary amount of open parentheses - # "pop" events trigger committing their allocations to the memory stats # - For UX purposes, the left parens should also be committed as soon as possible, without double-counting the allocations made before calling h_do_parse() again, or returning # - Working with these stack events is pretty similar to drawing flame graphs: https://brendangregg.com/FlameGraphs/memoryflamegraphs.html + # - semantically, the number attached to a stack event means "total allocated bytes BEFORE anything this parser does" in case of a push, whereas it means "total allocated bytes AFTER everything this parser does" with pop events # Avoiding double-counting allocations: # Handling the list as above will often add allocations pertaining to stack frames/parser contexts that have not finished applying yet. (All the '(' symbols at the end of the list for example) @@ -340,6 +340,9 @@ class ParserStack: print("commit_pop: ev_list:", ev_list) # DEBUG print("commit_pop: parser:", parser) # DEBUG + for index, event in enumerate(ev_list[::-1]): + pass + def commit_pushes_at_end(self): pass -- GitLab