diff --git a/gdb-port/top-level-parse.py b/gdb-port/top-level-parse.py index 0ec68aaf01ad59b27d5a528c779230c99c078fa7..0d9e9f22925848583d26c21f4536142c6fb49ff5 100644 --- a/gdb-port/top-level-parse.py +++ b/gdb-port/top-level-parse.py @@ -386,7 +386,6 @@ class TopLevelParse: # TODO: get_avg_mem_use_all_arenas, get_total_mem_use - # TODO: remove first printing loop def print_input_chunk(self, token, token_list, rows, start, end): #print("print_input_chunk(): start: ", start, "end: ", end) w = end-start @@ -412,12 +411,16 @@ class TopLevelParse: try: hpr = HParseResult(int(hparseresult_addr, 16)) + if token.address != hpr.ast.address: + raise RuntimeError("confused the info strings") info_strings.append(" ".join([hpr.str_no_deref(), str(tokenmap_entry)])) - except: + except Exception as err: + print("Got exception when validating tokeninfo: ", err) info_strings.append(" ".join(["invalid", str(tokenmap_entry)])) if tokenmap_entry['end'] <= end: - del self.tokens_from_previous_chunk[index] + del self.tokens_from_previous_chunk[index] # TODO: Maybe it's a bad idea to modify a container you're iterating on + while printing_index < len(token_list): token = token_list[printing_index] @@ -435,7 +438,13 @@ class TopLevelParse: try: hpr = HParseResult(int(hparseresult_addr, 16)) info_strings.append(" ".join([hpr.str_no_deref(), str(tokenmap_entry)])) - except: + if token.address != hpr.ast.address: + raise RuntimeError("confused the info strings") + except Exception as a: #DEBUG + print(a, "type:", type(a)) + print(traceback.format_exc()) + gdb.execute("list") + gdb.execute("backtrace") info_strings.append(" ".join(["invalid", str(tokenmap_entry)])) if tokenmap_entry['end'] > end: