================
@@ -0,0 +1,165 @@
+//===-- GoToTargetsRequestHandler.cpp 
-------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "DAP.h"
+
+#include "JSONUtils.h"
+
+#include <lldb/API/SBBreakpointLocation.h>
+#include <lldb/API/SBListener.h>
+#include <lldb/API/SBStream.h>
+
+namespace lldb_dap {
+
+static llvm::SmallVector<lldb::SBLineEntry>
+GetLineValidEntry(DAP &dap, const lldb::SBFileSpec &file_spec, uint32_t line) {
+  // disable breakpoint listeners so they do not send events to the DAP client.
+  lldb::SBListener listener = dap.debugger.GetListener();
+  lldb::SBBroadcaster broadcaster = dap.target.GetBroadcaster();
+  constexpr auto event_mask = lldb::SBTarget::eBroadcastBitBreakpointChanged;
+  listener.StopListeningForEvents(broadcaster, event_mask);
----------------
ashgti wrote:

I think we can use the `lldb.target.modules[0].FindCompileUnits()` to find this 
information without using a breakpoint.

Trying this out on the stepInTargets binary:

```
$ lldb lldb-dap/stepInTargets/TestDAP_stepInTargets.test_basic/a.out
(lldb) script
>>>[line_entry for line_entry in 
>>>lldb.target.modules[0].FindCompileUnits(lldb.SBFileSpec("lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp"))[0].compile_unit]
[
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:2, 
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:2:38,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:2:44,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:2:42,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:2:31,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:4:15,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:6:15,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:8,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:9:7,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:9:16,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:9:3,
  lldb/test/API/tools/lldb-dap/stepInTargets/main.cpp:10:3,
]
```

I'm not sure how we should scope those. We could use the block to scope the 
targets to the same block as the requested file:line:column.

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

Reply via email to