[Lldb-commits] [lldb] [lldb-dap] Fix source references (PR #144364)

John Harrison via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 16 10:57:57 PDT 2025


================
@@ -510,6 +510,25 @@ DAP::SendFormattedOutput(OutputType o, const char *format, ...) {
       o, llvm::StringRef(buffer, std::min<int>(actual_length, sizeof(buffer))));
 }
 
+int32_t DAP::CreateSourceReference(lldb::addr_t address) {
+  auto iter = llvm::find(source_references, address);
+  if (iter != source_references.end())
+    return std::distance(source_references.begin(), iter) + 1;
+
+  source_references.emplace_back(address);
+  return static_cast<int32_t>(source_references.size());
----------------
ashgti wrote:

We may need a mutex around this since the event thread could also interact with the list of source references.

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


More information about the lldb-commits mailing list