<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div>lldb doesn’t currently support breakpoint callbacks that try to control running the target in the callback. I’m not sure how easy it would be to support that reliably, but anyway, that doesn’t work at present.</div><div><br class=""></div><div>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 would proceed along however you wanted and log at each stop. Then your breakpoint callback would just queue up this step-and-trace plan as its last act. That’s what the Scripted ThreadPlans are for:</div><div><br class=""></div><div><a href="https://lldb.llvm.org/use/python-reference.html#using-the-python-api-to-create-custom-stepping-logic" class="">https://lldb.llvm.org/use/python-reference.html#using-the-python-api-to-create-custom-stepping-logic</a></div><div><br class=""></div><div>I’m not quite sure what you are describing with the process events approach. Are you trying to do this while also running in the lldb driver, or can you write a stand-alone tool to do this? If the latter, then it should be enough 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 events sent from the breakpoint callback.</div><div><br class=""></div><div>Jim</div><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 18, 2019, at 7:59 PM, Nikita Karetnikov via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hello,<br class=""><br class="">I'm trying to figure out how to write a simple tracer. Specifically, I want to<br class="">perform some 'step's after a breakpoint callback fires. How do I do that in<br class="">async mode?<br class=""><br class="">Here's my attempt:<br class=""><a href="https://gist.github.com/nkaretnikov/6ee00afabf73332c5a89eacb610369c2" target="_blank" class="">https://gist.github.com/nkaretnikov/6ee00afabf73332c5a89eacb610369c2</a><br class=""><br class="">The problem is that pc is not updated (pc: 0xffffffffffffffff) when the loop<br class="">executes the second time.<br class=""><br class="">I've also attempted to refactor this code based on:<br class=""><a href="http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py" target="_blank" class="">http://llvm.org/svn/llvm-project/lldb/trunk/examples/python/process_events.py</a><br class=""><br class="">My idea was to have a similar loop as the one that's after 'listener = ...'. It<br class="">would sit there waiting for events, and I would somehow broadcast an event from<br class="">the callback. Maybe with 'state == lldb.eStateStopped' and a global variable<br class="">allowing me to distinguish this event type from the rest.<br class=""><br class="">But I can't find a way to do this. Either I get the same behavior as without<br class="">events or my events are ignored completely (likely because I use them<br class="">incorrectly).<br class=""><br class="">I haven't published the code of the event version, but I can do that later<br class="">unless someone proposes a working solution right away.<br class=""><br class="">Thanks,<br class="">Nikita<br class=""></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></body></html>