From 54ab35fe8a87ba38336cb459ff8f3d5360950954 Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Wed, 25 Jan 2023 16:47:10 +0100
Subject: [PATCH] Avoid accidentally turning allocation counts into gdb.Values

---
 gdb-port/top-level-parse.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py
index 1a4623a..e981142 100644
--- a/gdb-port/top-level-parse.py
+++ b/gdb-port/top-level-parse.py
@@ -65,7 +65,7 @@ class TopLevelParse:
 		parser_stack = self.peek_parserstack()
 		#if self.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS
 		if self.extended_arena_stats_available(): # DEBUG
-			self.bytes_at_enter.append(arena['arena_malloc_bytes'])
+			self.bytes_at_enter.append(int(arena['arena_malloc_bytes']))
 			self.cumulative_byte_differences = [] # TODO: direction
 
 		try:
@@ -87,7 +87,7 @@ class TopLevelParse:
 
 		#if self.memory_stat_method == HammerMemoryStatisticsMethod.DETAILED_ARENA_STATS
 		if self.extended_arena_stats_available(): # DEBUG
-			newbytes = parse_state['arena']['arena_malloc_bytes']
+			newbytes = int(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
 			self.total_byte_differences.insert(-len(self.cumulative_byte_differences), allocated_bytes)
-- 
GitLab