[Lldb-commits] [lldb] [lldb-dap] assembly breakpoints (PR #139969)

Ely Ronnen via lldb-commits lldb-commits at lists.llvm.org
Sun May 18 04:46:00 PDT 2025


================
@@ -73,7 +87,64 @@ SetBreakpointsRequestHandler::Run(
     }
   }
 
-  return protocol::SetBreakpointsResponseBody{std::move(response_breakpoints)};
+  return response_breakpoints;
+}
+
+std::vector<protocol::Breakpoint>
+SetBreakpointsRequestHandler::SetAssemblyBreakpoints(
+    const protocol::Source &source,
+    const std::optional<std::vector<protocol::SourceBreakpoint>> &breakpoints)
+    const {
+  std::vector<protocol::Breakpoint> response_breakpoints;
+  int64_t sourceReference = source.sourceReference.value_or(0);
+
+  lldb::SBAddress address(sourceReference, dap.target);
+  if (!address.IsValid())
+    return response_breakpoints;
+
+  lldb::SBSymbol symbol = address.GetSymbol();
+  if (!symbol.IsValid())
+    return response_breakpoints; // Not yet supporting breakpoints in assembly
+                                 // without a valid symbol
+
+  llvm::DenseMap<uint32_t, SourceBreakpoint> request_bps;
+  if (breakpoints) {
+    for (const auto &bp : *breakpoints) {
+      SourceBreakpoint src_bp(dap, bp);
+      request_bps.try_emplace(src_bp.GetLine(), src_bp);
+      const auto [iv, inserted] =
+          dap.assembly_breakpoints[sourceReference].try_emplace(
----------------
eronnen wrote:

:100: Great idea, moved this implementation to a DAP function using the same function for both source and assembly breakpoints

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


More information about the lldb-commits mailing list