| 1 | // clang-format off |
| 2 | // REQUIRES: lld, x86 |
| 3 | |
| 4 | // Test that lldb can find the PDB file that corresponds to the executable. The linker |
| 5 | // writes a path to the PDB in the executable. If the PDB is not there, lldb should |
| 6 | // check the directory that contains the executable. We'll generate the PDB file in |
| 7 | // a subdirectory and then move it into the directory with the executable. That will |
| 8 | // ensure the PDB path stored in the executable is wrong. |
| 9 | |
| 10 | // Build an EXE and PDB in different directories |
| 11 | // RUN: mkdir -p %t/executable |
| 12 | // RUN: rm -f %t/executable/foo.exe %t/executable/bar.pdb |
| 13 | // RUN: mkdir -p %t/symbols |
| 14 | // RUN: rm -f %t/symbols/bar.pdb |
| 15 | // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t/executable/foo.obj -- %s |
| 16 | // RUN: lld-link -debug:full -nodefaultlib -entry:main %t/executable/foo.obj \ |
| 17 | // RUN: -out:%t/executable/foo.exe -pdb:%t/symbols/bar.pdb |
| 18 | |
| 19 | // Find the PDB in its build location |
| 20 | // RUN: %lldb -f %t/executable/foo.exe -s \ |
| 21 | // RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s |
| 22 | |
| 23 | // Also find the PDB when it's adjacent to the executable |
| 24 | // RUN: mv -f %t/symbols/bar.pdb %t/executable/bar.pdb |
| 25 | // RUN: %lldb -f %t/executable/foo.exe -s \ |
| 26 | // RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s |
| 27 | |
| 28 | int main(int argc, char** argv) { |
| 29 | return 0; |
| 30 | } |
| 31 | |
| 32 | // CHECK: (lldb) target modules dump symfile |
| 33 | // CHECK: Dumping debug symbols for 1 modules. |
| 34 | // CHECK: SymbolFile native-pdb |
| 35 | |