diff --git a/gdb-port/ast.py b/gdb-port/ast.py index ea2ab1c11f826257b5e00c56ec93a58c20aae905..f661cf69ab43fdbdec639b370d6a9246205e8d12 100644 --- a/gdb-port/ast.py +++ b/gdb-port/ast.py @@ -17,6 +17,9 @@ class HParseResult: # AST is not null # Some combinators, such as h_ignore(), return a ParseResult with no AST def read_AST_not_null(self): + if self.address == 0: + return False + if not __class__.HParseResult_t_p: __class__.HParseResult_t_p = gdb.lookup_type("HParseResult").pointer() res = gdb.Value(self.address).cast(__class__.HParseResult_t_p) diff --git a/gdb-port/commands.py b/gdb-port/commands.py index 8d906f25ffd7c9e2bac52f4459fc6b7a7d32ded0..90502da1843566e3c3869d7f4f4ff757fea0887d 100644 --- a/gdb-port/commands.py +++ b/gdb-port/commands.py @@ -195,6 +195,8 @@ class HammerParseStepToResult(FlowControlWithPrint): if gdb.selected_inferior().pid > 0: gdb.execute("continue") + top_level_parse.clear_ast_stack_index() + self.conditionally_print_backtrace() HammerParseStepToResult()