diff --git a/gdb-port/utility-commands.py b/gdb-port/utility-commands.py index f446ec887d2deb2e1edb267d2caea0dd60c54879..df25c1077c5bb5c89fbbaf69500c8534c608f6d6 100644 --- a/gdb-port/utility-commands.py +++ b/gdb-port/utility-commands.py @@ -17,7 +17,17 @@ class HammerParseStep(gdb.Command): def invoke(self, arg, from_tty): args = gdb.string_to_argv(arg) - steps = int(args[0]) + if len(args) > 0: + try: + steps = int(args[0]) + if steps < 1: + raise ValueError + except ValueError: + print("Arugment needs to be a positive integer") + return + else: + steps = 1 + gdb.set_convenience_variable("hammer_step_counter", int(steps)) # Counting the stops is the responsibility of HDoParseBreakpoint # On each breakpoint hit, something like this is executed in HDoParseBreakpoint.stop():