xref: /openbsd-src/gnu/llvm/lldb/examples/python/step_and_print.py (revision f6aab3d83b51b91c24247ad2c2573574de475a82)
1061da546Spatrick""" Does a step-over then prints the local variables or only the ones passed in """
2061da546Spatrickimport lldb
3061da546Spatrick
4061da546Spatrickclass StepAndPrint:
5061da546Spatrick    def __init__(self, debugger, unused):
6061da546Spatrick        return
7061da546Spatrick
8061da546Spatrick    def __call__(self, debugger, command, exe_ctx, result):
9061da546Spatrick        # Set the command to synchronous so the step will complete
10061da546Spatrick        # before we try to run the frame variable.
11061da546Spatrick        old_async = debugger.GetAsync()
12061da546Spatrick        debugger.SetAsync(False)
13061da546Spatrick
14061da546Spatrick        debugger.HandleCommand("thread step-over")
15061da546Spatrick        print("---------- Values: -------------------\n")
16061da546Spatrick        debugger.HandleCommand("frame variable %s"%(command))
17061da546Spatrick
18061da546Spatrick        debugger.SetAsync(old_async)
19061da546Spatrick
20061da546Spatrick    def get_short_help(self):
21061da546Spatrick        return "Does a step-over then runs frame variable passing the command args to it\n"
22061da546Spatrick
23061da546Spatrickdef __lldb_init_module(debugger, unused):
24*f6aab3d8Srobert    debugger.HandleCommand("command script add -o -c step_and_print.StepAndPrint sap")
25