[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


================
@@ -37,10 +37,15 @@ protocol::Source CreateSource(const lldb::SBFileSpec &file);
 /// \param[in] target
 ///     The target that has the address.
 ///
+/// \param[in] create_reference
+///     function used to create a source_reference
+///
 /// \return
-///     A "Source" JSON object that follows the formal JSON
+///     An optional "Source" JSON object that follows the formal JSON
 ///     definition outlined by Microsoft.
-protocol::Source CreateSource(lldb::SBAddress address, lldb::SBTarget &target);
+std::optional<protocol::Source>
+CreateSource(lldb::SBAddress address, lldb::SBTarget &target,
+             llvm::function_ref<int32_t(lldb::addr_t)> create_reference);
----------------
ashgti wrote:

Should we move this into the `DAP`? Something like `optional<Source> DAP::ResolveSource(SBAddress, SBTarget);` that creates or returns a source for the given address?

Or we could move the actual address info into the `adapterData` field and then we don't need to track the address in the DAP, we'd just need to have some way of hashing the address into a unique `sourceReference`.

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


More information about the lldb-commits mailing list