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

via lldb-commits lldb-commits at lists.llvm.org
Wed Mar 26 16:22:22 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);
----------------
jimingham wrote:

There are other types of queries that might be interesting here, like "file and line contained in another file or function" - when you're looking for inlining that's handy.  I'm not saying that we should support those up front, but if we can think of a couple more things like that that we'd want to do, it might be worth coming up with a container (like SBLineEntrySpec) that we can then add to as we go w/o having to change the API's.


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


More information about the lldb-commits mailing list