[Lldb-commits] [lldb] Initial step in targets DAP support (PR #86623)

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 27 14:56:53 PDT 2024


jeffreytan81 wrote:

@jimingham, thanks for detailed comment. 

"Step in targets" or "Step Into Specific" is an IDE feature that works in two steps:
1. Show a list of call sites before stepping to allow users specify which call to step into
2. Perform step into with user choosing call site function to stop. 
https://www.tabsoverspaces.com/233742-step-into-a-specific-call-when-debugging-in-visual-studio contains a good screenshot.

Note: in step 1, we will have to show users the callsite target function *before* performing stepping. For indirect/virtual call, you can't reliable resolve the target function name without running a smaller interpreter to simulate the execution. 

> I don't think there's any way you are going to know what address "method_call" 
> will resolve to in this context. You'd have to know what "this" actually is, and deal with overload resolution, etc. That does > not sound very doable to me.

I am not proposing using the function target PC, but the call instruction address in the call site side. For example:
```
    0x55555555a426 <+934>:  callq  0x555555558990 ; bar at main.cpp:64
    0x55555555a42b <+939>:  movl   %eax, -0xb0(%rbp)
    0x55555555a431 <+945>:  callq  0x5555555589a0 ; bar2 at main.cpp:68
    0x55555555a436 <+950>:  movl   -0xb0(%rbp), %edi
    0x55555555a43c <+956>:  movl   %eax, %esi
    0x55555555a43e <+958>:  callq  0x555555558970 ; foo at main.cpp:60
```
For the above step range above, I propose us pass `0x55555555a431` as an extra callsite PC to underlying `ThreadPlanStepInRange`, so `ThreadPlanStepInRange::DoWillResume()` can detect the current IP would match the user specified call-site PC `0x55555555a431`. Then `ThreadPlanStepInRange::DefaultShouldStopHereCallback()` can detect the state that there is a previous matching callsite PC, so return true to stop when eFrameCompareYounger.




https://github.com/llvm/llvm-project/pull/86623


More information about the lldb-commits mailing list