From 64fbf621eabfbad4bdd8c7d9899c384497ee433b Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Mon, 27 Mar 2023 13:46:03 +0200
Subject: [PATCH] (WIP commit) Type bug identified, add TODO entry

---
 gdb-port/parser.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/gdb-port/parser.py b/gdb-port/parser.py
index 1d89967..2d7d0dd 100644
--- a/gdb-port/parser.py
+++ b/gdb-port/parser.py
@@ -76,8 +76,13 @@ class Parser:
 class ParserStack:
 	def __init__(self, parse_state, arena, top_level_parse):
 		self.parse_state = parse_state
+		self.parse_state_gdbval = parse_state
 		self.arena = arena
-		self.top_level_parse = top_level_parse
+		self.arena_gdbval = arena
+		# self.parse_state and self.arena is expected to be an int by TopLevelParse and is ultimately used to index into the memory usage dict
+		# parse_state is set by top_level_parse.first_h_do_parse_after_h_packrat_parse() to be an int
+		# TODO: remove the redundancy and convert to int when indexing the memory dict? maybe a get_parse_state_address() function?
+		self.top_level_parse = top_level_parse # To avoid depending on top_level_parse.py
 		self.p_stack = []
 		self.unclaimed_mem_use = 0
 		self.partial_alloc_counts = []
@@ -112,6 +117,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'])
 			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
-- 
GitLab