xref: /llvm-project/lldb/test/API/commands/watchpoints/watchpoint_commands/command/watchpoint_command.py (revision 2238dcc39358353cac21df75c3c3286ab20b8f53)
1import lldb
2
3num_hits = 0
4
5
6def watchpoint_command(frame, wp, dict):
7    global num_hits
8    if num_hits == 0:
9        print("I stopped the first time")
10        frame.EvaluateExpression("cookie = 888")
11        num_hits += 1
12        return True
13    if num_hits == 1:
14        print("I stopped the second time, but with no return")
15        frame.EvaluateExpression("cookie = 666")
16        num_hits += 1
17    else:
18        print("I stopped the %d time" % (num_hits))
19        frame.EvaluateExpression("cookie = 999")
20        return False  # This cause the process to continue.
21