From 38b6736d0edbf22f0b83568008794d29ef73dfa6 Mon Sep 17 00:00:00 2001 From: pompolic <pompolic@special-circumstanc.es> Date: Fri, 14 Apr 2023 21:14:39 +0200 Subject: [PATCH] New parameter to ParserStack.pop(), should_commit --- gdb-port/parser.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 58cd12e..80ae0ff 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -132,7 +132,7 @@ class ParserStack: # On a pop() operation, to compute the difference, the code needs to find the corresponding push(), subtract amb_2-amb_1, then from the result, recursively subtract the (amb_2-amb_1) differences of the push()/pop() pairs inbetween # The push/pop operations are implicitly guaranteed to be balanced so long as execution proceeds normally - def push(self, parser): + def push(self, parser, should_commit=False): self.p_stack.append(parser) self.partial_alloc_counts.append(None) if self.top_level_parse.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS: @@ -155,6 +155,8 @@ class ParserStack: # Additionally, it would probably make more sense to store it at the ParserStack, storing (frame, bytes) pairs self.bytes_since_prev_h_do_parse.append(thusfar) # TODO: where should commit_on_push() be called? HDoParseBreakpoint determines whether to stop, which ParserStack doesn't know about. could be a bool parameter to push() + if should_commit: + self.commit_on_push() def pop(self): self.partial_alloc_counts.pop() -- GitLab