<div dir="ltr"><div dir="ltr">Jim,<br><br>> My model for this sort of tracing activity is that you are writing a fancy kind<br>> of “step” operation.  You would write a fancy step & record plan that would<br>> proceed along however you wanted and log at each stop.  Then your breakpoint<br>> callback would just queue up this step-and-trace plan as its last act.  That’s<br>> what the Scripted ThreadPlans are for:<br>><br>> <a href="https://lldb.llvm.org/use/python-reference.html#using-the-python-api-to-create-custom-stepping-logic">https://lldb.llvm.org/use/python-reference.html#using-the-python-api-to-create-custom-stepping-logic</a><br><br>How do I queue up the thread plan in the callback?<br><br>Here's my attempt:<br><a href="https://gist.github.com/nkaretnikov/6ee00afabf73332c5a89eacb610369c2#file-scripted_step-py">https://gist.github.com/nkaretnikov/6ee00afabf73332c5a89eacb610369c2#file-scripted_step-py</a><br><br>This is based on:<br><a href="https://github.com/llvm/llvm-project/blob/master/lldb/examples/python/scripted_step.py">https://github.com/llvm/llvm-project/blob/master/lldb/examples/python/scripted_step.py</a><br><br>The original 'SimpleStep' class implementation works when run as:<br>thread step-scripted -C scripted_step.SimpleStep<br><br>Not sure if my current version of 'SimpleStep' is correct (I've made a few<br>changes since testing via 'thread step-scripted'), but nothing happens (no<br>prints on '__init__') when I add the class via 'StepUsingScriptedThreadPlan' in<br>the callback.<br><br>What's the proper way to do this?<br><br>Or do I need to mimic one of the classes with a 'thread_plan.QueueThreadPlan*'<br>method call?  I couldn't figure out how to trace with anything besides the<br>'SimpleStep' class when running via 'thread step-scripted', so I stuck with it.<br><br>> I’m not quite sure what you are describing with the process events approach.<br>> Are you trying to do this while also running in the lldb driver, or can you<br>> write a stand-alone tool to do this?  If the latter, then it should be enough<br>> to program everything at the event loop level.  You will know when your<br>> breakpoint is hit, then you can issue the steps one by one and do whatever<br>> logging you want each time you stop.  I’m not sure why this would need events<br>> sent from the breakpoint callback.<br><br>Nevermind the events thing, then.  I just run the lldb command and then do:<br>command script import $FILE<br><br>Ideally, I want to keep it this way so I could debug manually if needed.<br><br>Thanks,<br>Nikita</div></div>