jimingham 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, if user wants to step into "bar2()" function, 
> 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.
> 
> Hope this makes sense.

That sounds fine.  I try to stay out of the game of telling people what is 
going to run in any given range of code because it is pretty hard to get that 
right from assembly, whereas if you watch execution you are always right.  But 
if that's what the DAP requires, that seems to be your fate.

It would be fine to add an `m_step_into_target_addr` to ThreadPlanStepInRange 
and check that in its ShouldStopHereCallback.  Not sure why you mention 
DoWillResume, that's not where ShouldStopHere gets called, and deciding your 
step was done then would be way too late in the whole "I've stopped, what 
should I do next" negotiation.  But if you put it in the ShouldStopHereCallback 
it will get called at the right time.

https://github.com/llvm/llvm-project/pull/86623
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to