================
@@ -657,18 +657,29 @@ std::optional<protocol::Source> DAP::ResolveSource(const 
lldb::SBFrame &frame) {
   if (!frame.IsValid())
     return std::nullopt;
 
-  const lldb::SBAddress frame_pc = frame.GetPCAddress();
-  if (DisplayAssemblySource(debugger, frame_pc))
+  // IMPORTANT: Get line entry from symbol context, NOT from PC address.
+  // When a frame's PC points to a return address (the instruction
+  // after a call), that address may have line number 0 for compiler generated
+  // code.
+  //
+  // EXAMPLE: If PC is at 0x1004 (frame return address after the call
+  // instruction) with no line info, but 0x1003 (in the middle of previous call
+  // instruction) is at line 42, symbol context returns line 42.
+
----------------
da-viper wrote:

```suggestion
```
we could probably remove this as we now have a test case covering it. 

https://github.com/llvm/llvm-project/pull/165944
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to