Issue 169628
Summary LLDB cannot load PDB symbols if the PDB path differs from the one embedded in the .exe
Labels new issue
Assignees
Reporter ntoslinux
    I am trying to debug a Windows PE file (.exe) using LLDB(`lldb version 21.1.3`) but am unable to get LLDB to load the PDB file, which is located in a different directory (`D:\repos\samplec\temp`) than the source directory (`D:\repos\samplec\`). `test.c` is a simple C file(attached) with a trivial `main` function.

```
cl test.c /Zi /sdl- /GS- /link /INCREMENTAL:NO /PDBALTPATH:test.pdb  <-- VS2022

  Debug Directories

        Time Type        Size      RVA  Pointer
    -------- ------- -------- -------- --------
    6926D0DD cv            21 000693B0 67BB0    Format: RSDS, {D1494573-763E-4AB6-9F01-61F1A74097B4}, 6, test.pdb
```

I tried the following but could not get LLDB to load the symbols from the PDB file:

```
(lldb) settings show target.debug-file-search-paths
target.debug-file-search-paths (file-list) =
  [0]: D:\repos\samplec\temp
(lldb) target symbols add D:\repos\samplec\temp\test.pdb
symbol file 'D:\repos\samplec\temp\test.pdb' has been added to 'D:\repos\samplec\test.exe'
(lldb) target module list
[  0] D1494573-763E-4AB6-9F01-61F1A74097B4-00000006 0x0000000140000000 D:\repos\samplec\test.exe
 D:\repos\samplec\temp\test.pdb
(lldb) target modules lookup -A -n main
(lldb) target module dump symfile
Dumping debug symbols for 1 module.
SymbolFile pdb (D:\repos\samplec\test.exe)
Types:

Compile units:

Symtab, file = D:\repos\samplec\test.exe, num_symbols = 0
```

It works if I don't move the PDB file to a different directory:

```
D:\repos\samplec>lldb test.exe
(lldb) target create "test.exe"
Current executable set to 'D:\repos\samplec\test.exe' (x86_64).
(lldb) target modules lookup -A -n main
1 match found in D:\repos\samplec\test.exe:
        Address: test.exe[0x00000001400010e0] (test.exe..text + 224)
        Summary: test.exe`main at test.c:28
```

Reference: https://discourse.llvm.org/t/lldb-functionality-for-debugging-windows-binaries-when-the-path-to-pdb-file-is-different-from-one-embedded-into-the-exe-file/88969

[test.c](https://github.com/user-attachments/files/23767677/test.c)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to