From e87016b715138a1759ef8cea8e05066275b6a4c0 Mon Sep 17 00:00:00 2001
From: pompolic <pompolic@special-circumstanc.es>
Date: Tue, 8 Nov 2022 21:01:04 +0100
Subject: [PATCH] Fix some tokens missing starting indices

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

diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py
index cbd2006..29beb5f 100644
--- a/gdb-port/top-level-parse.py
+++ b/gdb-port/top-level-parse.py
@@ -337,7 +337,12 @@ class TopLevelParse:
 		if w == 0:
 			print("all tokens passed to display are zero-width")
 			return
-		tokenmap_val_list = [dict(token, addr=hex(key)) for key, token in self.input_token_map.items() if (token['start'] >= start and token['start'] <= end)]
+		try:
+			tokenmap_val_list = [dict(token, addr=hex(key)) for key, token in self.input_token_map.items() if (token['start'] >= start and token['start'] <= end)]
+		except TypeError as te:
+			print("DEBUG: problem token in print_input_chunk()")
+			print(self.input_token_map)
+			raise te
 		numrows = min(rows, len(tokenmap_val_list))
 		h = numrows
 		charbuf_dynamic = []
@@ -452,7 +457,7 @@ class TopLevelParse:
 		print(encoded_inputfragment)
 		self.print_input_chunk(token, printing_tokens, rows, start + w * screens, (start + w * screens) + min(w, end-start))
 		self.tokens_from_previous_chunk = []
-		self.starting_input_index = []
+		#TODO: clean up self.starting_input_index when when h_parse returns
 
 		#if rec_depth == 0:
 		#	print(encoded_inputfragment)
-- 
GitLab