[Lldb-commits] [lldb] [lldb-dap] Fix source references (PR #144364)
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 17 09:39:18 PDT 2025
================
@@ -46,21 +46,27 @@ static bool ShouldDisplayAssemblySource(
return false;
}
-static protocol::Source CreateAssemblySource(const lldb::SBTarget &target,
- lldb::SBAddress address) {
- protocol::Source source;
+std::optional<protocol::Source> CreateAssemblySource(
+ const lldb::SBTarget &target, lldb::SBAddress address,
+ llvm::function_ref<int32_t(lldb::addr_t)> create_reference) {
- auto symbol = address.GetSymbol();
+ lldb::SBSymbol symbol = address.GetSymbol();
+ lldb::addr_t load_addr = LLDB_INVALID_ADDRESS;
std::string name;
if (symbol.IsValid()) {
- source.sourceReference = symbol.GetStartAddress().GetLoadAddress(target);
+ load_addr = symbol.GetStartAddress().GetLoadAddress(target);
name = symbol.GetName();
} else {
- const auto load_addr = address.GetLoadAddress(target);
- source.sourceReference = load_addr;
+ load_addr = address.GetLoadAddress(target);
name = GetLoadAddressString(load_addr);
}
+ if (load_addr == LLDB_INVALID_ADDRESS) {
+ return std::nullopt;
+ }
----------------
JDevlieghere wrote:
No braces
https://github.com/llvm/llvm-project/pull/144364
More information about the lldb-commits
mailing list