2

I've written a python script that I am attaching to a watchpoint in LLDB, such as:

def wpCallback(frame, wp, internal_dict):
    ...

and I am attaching the callback with:

watchpoint command add -F commands.wpCallback watchpointID

I would like execution of the program to immediately resume after wpCallback is finished. Currently, execution halts as the watchpoint normally would. Is it possible to silently continue after the function is done? Based on this answer it seems like you can do something like this in GDB:

break foo if x>0
commands
silent
do something...
cont
end
Community
  • 1
  • 1
Matt
  • 4,029
  • 3
  • 20
  • 37

1 Answers1

1

You should be able to call SBProcess.Continue() on your process in your watchpoint callback. I.e. if you called the first argument to your callback frame do:

frame.thread.process.Continue()

That works for breakpoints, but seems to be broken for watchpoints in current TOT lldb. It looks like it disables the watchpoint. That's:

https://llvm.org/bugs/show_bug.cgi?id=28055

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • Have you tried that recently @jim? With regular breakpoints in a lldb-python script it is not continuing. I am getting the Frame from `frame = exe_ctx.frame` when my script starts. `lldb-1103.0.22.10` . That is `XCode Version 11.6 ` – rustyMagnet Oct 02 '20 at 11:18
  • You mention an exe_ctx as the way to get a frame, not the frame directly so I think you aren't talking about a Python breakpoint callback but rather a Python based command? I can't tell from your description what you are doing with enough specificity to start trying to reproduce what you are seeing. If you have a particular case that's not working, its probably best to file a bug with http://bugs.llvm.org. – Jim Ingham Oct 02 '20 at 17:35
  • Thanks. It continued when I got the `SBProcess` instance this way -> `target = debugger.GetSelectedTarget()` and `process = target.GetProcess()`. I put another SO ticket as I am missing something for the pretty way to achieve this: https://stackoverflow.com/questions/64205500/continue-after-python-lldb-script-has-finished – rustyMagnet Oct 05 '20 at 09:06