[lldb-dev] Stepping in a breakpoint callback with Python

Nikita Karetnikov via lldb-dev lldb-dev at lists.llvm.org
Sat Sep 21 11:11:16 PDT 2019


> My model for this sort of tracing activity is that you are writing a
fancy kind
> of “step” operation.  You would write a fancy step & record plan that
> proceed along however you wanted and log at each stop.  Then your
> callback would just queue up this step-and-trace plan as its last act.
> what the Scripted ThreadPlans are for:

How do I queue up the thread plan in the callback?

Here's my attempt:

This is based on:

The original 'SimpleStep' class implementation works when run as:
thread step-scripted -C scripted_step.SimpleStep

Not sure if my current version of 'SimpleStep' is correct (I've made a few
changes since testing via 'thread step-scripted'), but nothing happens (no
prints on '__init__') when I add the class via
'StepUsingScriptedThreadPlan' in
the callback.

What's the proper way to do this?

Or do I need to mimic one of the classes with a
method call?  I couldn't figure out how to trace with anything besides the
'SimpleStep' class when running via 'thread step-scripted', so I stuck with

> I’m not quite sure what you are describing with the process events
> Are you trying to do this while also running in the lldb driver, or can
> write a stand-alone tool to do this?  If the latter, then it should be
> to program everything at the event loop level.  You will know when your
> breakpoint is hit, then you can issue the steps one by one and do whatever
> logging you want each time you stop.  I’m not sure why this would need
> sent from the breakpoint callback.

Nevermind the events thing, then.  I just run the lldb command and then do:
command script import $FILE

Ideally, I want to keep it this way so I could debug manually if needed.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20190921/a0ede0d7/attachment.html>

More information about the lldb-dev mailing list