[Lldb-commits] [lldb] [llvm] [lldb][lldb-dap] Implement jump to cursor (PR #130503)

Adrian Vogelsgesang via lldb-commits lldb-commits at lists.llvm.org
Fri Mar 28 03:05:55 PDT 2025


================
@@ -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);
----------------
vogelsgesang wrote:

If we add a new API, we should make sure it also covers the "get column breakpoints" use case. See the [current source code](https://github.com/llvm/llvm-project/blob/b82fd7110972c52cf4e58bf08b65bce7a91ecb0e/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp#L157) which iterates over the line tables manually. In the PR which introduced column-breakpoint support for lldb-dap, we already had a [similar discussion on exposing a new SB-API](https://github.com/llvm/llvm-project/pull/113787/files/4e05a8e1bb01e4b1472e9ec81111d9a169cdf793#r1827507293).

For the API, this would mean that:
* We should be able to search for a line-range and not only for a single line
* We should be able to restrict the column numbers
* We need a way to return all column positions within the line(s) on which we could potentially stop

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


More information about the lldb-commits mailing list