1479f5bfdSAdrian McCarthy // clang-format off 2479f5bfdSAdrian McCarthy // REQUIRES: lld, x86 3479f5bfdSAdrian McCarthy 4479f5bfdSAdrian McCarthy // Test that lldb can find the PDB file that corresponds to the executable. The linker 5479f5bfdSAdrian McCarthy // writes a path to the PDB in the executable. If the PDB is not there, lldb should 6479f5bfdSAdrian McCarthy // check the directory that contains the executable. We'll generate the PDB file in 7479f5bfdSAdrian McCarthy // a subdirectory and then move it into the directory with the executable. That will 8479f5bfdSAdrian McCarthy // ensure the PDB path stored in the executable is wrong. 9479f5bfdSAdrian McCarthy 10479f5bfdSAdrian McCarthy // Build an EXE and PDB in different directories 11479f5bfdSAdrian McCarthy // RUN: mkdir -p %t/executable 12479f5bfdSAdrian McCarthy // RUN: rm -f %t/executable/foo.exe %t/executable/bar.pdb 13479f5bfdSAdrian McCarthy // RUN: mkdir -p %t/symbols 14479f5bfdSAdrian McCarthy // RUN: rm -f %t/symbols/bar.pdb 15479f5bfdSAdrian McCarthy // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t/executable/foo.obj -- %s 16479f5bfdSAdrian McCarthy // RUN: lld-link -debug:full -nodefaultlib -entry:main %t/executable/foo.obj \ 17479f5bfdSAdrian McCarthy // RUN: -out:%t/executable/foo.exe -pdb:%t/symbols/bar.pdb 18479f5bfdSAdrian McCarthy 19479f5bfdSAdrian McCarthy // Find the PDB in its build location 20479f5bfdSAdrian McCarthy // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t/executable/foo.exe -s \ 21479f5bfdSAdrian McCarthy // RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s 22479f5bfdSAdrian McCarthy 23479f5bfdSAdrian McCarthy // Also find the PDB when it's adjacent to the executable 24479f5bfdSAdrian McCarthy // RUN: mv -f %t/symbols/bar.pdb %t/executable/bar.pdb 25479f5bfdSAdrian McCarthy // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t/executable/foo.exe -s \ 26479f5bfdSAdrian McCarthy // RUN: %p/Inputs/locate-pdb.lldbinit | FileCheck %s 27479f5bfdSAdrian McCarthy main(int argc,char ** argv)28479f5bfdSAdrian McCarthyint main(int argc, char** argv) { 29479f5bfdSAdrian McCarthy return 0; 30479f5bfdSAdrian McCarthy } 31479f5bfdSAdrian McCarthy 32479f5bfdSAdrian McCarthy // CHECK: (lldb) target modules dump symfile 33479f5bfdSAdrian McCarthy // CHECK: Dumping debug symbols for 1 modules. 34*a3939e15SPavel Labath // CHECK: SymbolFile native-pdb 35