================ @@ -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( ---------------- JDevlieghere wrote:
This together with the logic to either add or update a breakpoint seems like it could be abstracted away behind a function in the dap class. Something like `dap.SetAssemblyBreakpoint(uint32_t line, SourceBreakpoint& source_bp)`. Same thing with the delete below and then we can make `assembly_breakpoints` a member and provide some more abstraction. https://github.com/llvm/llvm-project/pull/139969 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits