[lldb-dev] Enabling single-step mode and acting on each executed instruction

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Fri Jun 28 10:50:36 PDT 2019


Stop hooks only trigger when control is about to be returned to the user.  And in its normal mode, lldb doesn't step instruction all the time anyway...  So I don't think they would do what Vangelis wants.  He would have to drive the debugger with only the step-instruction command, which I think qualifies as interfering with stepping.

The ThreadPlanTracer is really the ticket, it does force the debugging to only instruction single step when it is realizing the more complex stepping operations, and then has hooks on each instruction stop.

Sean and I added this facility way way back in the early days of lldb because we needed it to figure out some problems with the expression parser.  We weren't really sure whether we were going to promote it more broadly and were waiting for some more interest to spend time cleaning it up and writing tests, etc.  Then years passed... So it is not entirely surprising that the facility needs some attention.  If somebody wants to take a stab at making this work reliably again, that would be awesome!

Jim
 


> On Jun 28, 2019, at 7:09 AM, Ted Woodward via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> You want to set up a stop-hook.
>  
> See “help target stop-hook”, specifically “help target stop-hook add”.
>  
> target stop-hook add -o “register read pc”
> will read the pc each time the target stops.
>  
> From: lldb-dev <lldb-dev-bounces at lists.llvm.org> On Behalf Of Vangelis Tsiatsianas via lldb-dev
> Sent: Friday, June 28, 2019 6:16 AM
> To: via lldb-dev <lldb-dev at lists.llvm.org>
> Cc: Vangelis Tsiatsianas <vangelists at icloud.com>
> Subject: [EXT] [lldb-dev] Enabling single-step mode and acting on each executed instruction
>  
> Hello,
>  
> I would like to set the target in single-step mode and perform an action right after each instruction is executed. Notably, it is crucial to do so transparently, i.e. without interfering with user breakpoints, watchpoints, stepping etc..
>  
> Could you provide me with some guidance on how to accomplish it? 🙂
>  
> I have found the target.process.thread.trace-thread option and the relevant classes (ThreadPlanTracer and ThreadPlanAssemblyTracer), which although seem to not work and also crash the debugger when enabled.
>  
> Thank you very much, in advance.
>  
>  
> ― Vangelis
>  
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev



More information about the lldb-dev mailing list