llvmbot wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Gary Beihl (garybeihl)

<details>
<summary>Changes</summary>

…resses

UEFI executables are relocatable PE/COFF images where GetFileAddress() returns 
LLDB_INVALID_ADDRESS, causing symbol load failure from PDB files.

Use base address 0 when load address is invalid, allowing symbols to be loaded 
with their RVAs. LLDB automatically detects the runtime address during live 
debugging, or users can adjust via `target modules load --slide`.

Tested with Rust UEFI binaries, successfully loading 5,405 symbols with full 
source and line information.

Fixes: #<!-- -->91060

---
Full diff: https://github.com/llvm/llvm-project/pull/173499.diff


1 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
(+11) 


``````````diff
diff --git a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp 
b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
index 3bf113a07d28c..85abbdc741299 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp
@@ -422,6 +422,17 @@ void SymbolFileNativePDB::InitializeObject() {
                            ->GetObjectFile()
                            ->GetBaseAddress()
                            .GetFileAddress();
+
+  // For UEFI/PE binaries and other relocatable images without a predetermined
+  // load address, GetFileAddress() returns LLDB_INVALID_ADDRESS. Use base
+  // address 0 to allow symbols to be loaded with RVA (Relative Virtual 
Address).
+  // When debugging a live process, LLDB will automatically detect the actual
+  // runtime load address (slide) when execution stops. For symbol-only 
inspection
+  // or if auto-detection fails, use 'target modules load --slide <address>'.
+  if (m_obj_load_address == LLDB_INVALID_ADDRESS) {
+    m_obj_load_address = 0x0;
+  }
+
   m_index->SetLoadAddress(m_obj_load_address);
   m_index->ParseSectionContribs();
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/173499
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to