diff --git a/gdb-port/commands.py b/gdb-port/commands.py index 90502da1843566e3c3869d7f4f4ff757fea0887d..17f6cc74b0a99c54865324f74cebbda589ddc9a1 100644 --- a/gdb-port/commands.py +++ b/gdb-port/commands.py @@ -181,14 +181,14 @@ class HammerParseStepToResult(FlowControlWithPrint): def invoke(self, arg, from_tty): args = gdb.string_to_argv(arg) - index = -1 + index = 0 if len(args) < 1: print("No argument given. Execution will be stopped after the current parser being applied returns its result.") - - try: - index = int(args[0]) - except ValueError: - print("Argument needs to be an integer. Execution will be stopped after the current parser being applied returns its result.") + else: + try: + index = int(args[0]) + except ValueError: + print("Argument needs to be an integer. Execution will be stopped after the current parser being applied returns its result.") top_level_parse.setup_ast_stack_index(index) # HDoParseRetBreakpoint sets hammer_step_counter to 1 after capturing the AST subtree, so this will stop at the first h_do_parse invocation afterwards