diff --git a/gdb-port/commands.py b/gdb-port/commands.py index c792d5083f2fd08fd9d3829b267704593fc209fc..92c242bef93bd0b9393f09edb5766a5aabe283a8 100644 --- a/gdb-port/commands.py +++ b/gdb-port/commands.py @@ -32,17 +32,18 @@ class HammerParserBacktrace(gdb.Command): maxsize = len(parserstack) print("Argument must be a positive integer") - parser_name = top_level_parse.h_do_parse_parser.name or "(Parser type resolution pending)" # TODO: should we just look at the vtable and name the parser in h_do_parse? - - print("[" + str(hex(top_level_parse.h_do_parse_parser.address)) + "] " + parser_name + " [current]") #TODO: GUI widget should reflect this - print(" ") depth = min(len(parserstack), maxsize) if depth > 0: # if stack not empty # unsure what the idiomatic python is for handling negative indices starting with -1, # but this addition is to avoid off-by-one errors index = -(depth+1) + top = True for p in parserstack[-1:index:-1]: - print("[" + str(hex(p.address)) + "] " + p.name) # TODO: errors in perform_lowlevel_parse, if p.name is None + if not top: + print("[" + str(hex(p.address)) + "] " + p.get_name_or_placeholder()) + else: + print("[" + str(hex(p.address)) + "] " + p.get_name_or_placeholder(), "[current]") + top = False if depth < len(parserstack): print("[...]") diff --git a/gdb-port/parser.py b/gdb-port/parser.py index 56b1a554036836ff79ef48e1888ace785242937f..ad69b290f3cceb0508c499d8c5b1bcbf1b599e46 100644 --- a/gdb-port/parser.py +++ b/gdb-port/parser.py @@ -11,10 +11,10 @@ class Parser: def name_parser(self, name): self.name = name - # TODO: remove + # TODO: The parser could be named in h_do_parse by deducing from the vtable def get_name_or_placeholder(self): if self.name is None: - return "Wait for it... (if you're reading this, you found a bug)" + return "(Type resolution pending)" else: return self.name