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

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

3 Comments

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
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 bugs.llvm.org.
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: stackoverflow.com/questions/64205500/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.