21 lines · python
1import lldb2 3num_hits = 04 5 6def watchpoint_command(frame, wp, dict):7 global num_hits8 if num_hits == 0:9 print("I stopped the first time")10 frame.EvaluateExpression("cookie = 888")11 num_hits += 112 return True13 if num_hits == 1:14 print("I stopped the second time, but with no return")15 frame.EvaluateExpression("cookie = 666")16 num_hits += 117 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