77 lines · plain
1# REQUIRES: lld, target-windows2 3# Test where LLDB looks for PDBs.4# RUN: split-file %s %t5 6# RUN: mkdir -p %t/build7# RUN: mkdir -p %t/dir18# RUN: mkdir -p %t/dir29# RUN: mkdir -p %t/dir310 11# RUN: echo "settings append target.debug-file-search-paths %t/dir2" >> %t/init.input12# RUN: echo "settings append target.debug-file-search-paths %t/dir3" >> %t/init.input13 14# RUN: %build --compiler=clang-cl --nodefaultlib --output=%t/build/a.exe %t/main.cpp15 16# Regular setup - PDB is at the original path17# RUN: %lldb -S %t/init.input -s %t/check.input %t/build/a.exe | FileCheck --check-prefix=BOTH-ORIG %s18# BOTH-ORIG: (lldb) target create19# BOTH-ORIG-NEXT: Loading {{.*[/\\]}}build{{[/\\]}}a.pdb for {{.*[/\\]}}build{{[/\\]}}a.exe20# BOTH-ORIG: (A) a = (x = 47)21 22# Move the executable to a different directory but keep the PDB.23# RUN: mv %t/build/a.exe %t/dir124# RUN: %lldb -S %t/init.input -s %t/check.input %t/dir1/a.exe | FileCheck --check-prefix=PDB-ORIG %s25# PDB-ORIG: (lldb) target create26# PDB-ORIG-NEXT: Loading {{.*[/\\]}}build{{[/\\]}}a.pdb for {{.*[/\\]}}dir1{{[/\\]}}a.exe27# PDB-ORIG: (A) a = (x = 47)28 29# Copy the PDB to the same directory and all search dirs. LLDB should prefer the original PDB.30# RUN: cp %t/build/a.pdb %t/dir131# RUN: cp %t/build/a.pdb %t/dir232# RUN: cp %t/build/a.pdb %t/dir333# RUN: %lldb -S %t/init.input -s %t/check.input %t/dir1/a.exe | FileCheck --check-prefix=PDB-ORIG %s34 35# Remove the original PDB. LLDB should now use the one next to the exe.36# RUN: rm %t/build/a.pdb37# RUN: %lldb -S %t/init.input -s %t/check.input %t/dir1/a.exe | FileCheck --check-prefix=NEXT-TO-EXE %s38# NEXT-TO-EXE: (lldb) target create39# NEXT-TO-EXE-NEXT: Loading {{.*[/\\]}}dir1{{[/\\]}}a.pdb for {{.*[/\\]}}dir1{{[/\\]}}a.exe40# NEXT-TO-EXE: (A) a = (x = 47)41 42# Remove the PDB next to the exe. LLDB should now use the one in dir2 (first in list).43# RUN: rm %t/dir1/a.pdb44# RUN: %lldb -S %t/init.input -s %t/check.input %t/dir1/a.exe | FileCheck --check-prefix=DIR2 %s45# DIR2: (lldb) target create46# DIR2-NEXT: Loading {{.*[/\\]}}dir2{{[/\\]}}a.pdb for {{.*[/\\]}}dir1{{[/\\]}}a.exe47# DIR2: (A) a = (x = 47)48 49# Remove the PDB in dir2. LLDB should now use the one in dir3 (second in list).50# RUN: rm %t/dir2/a.pdb51# RUN: %lldb -S %t/init.input -s %t/check.input %t/dir1/a.exe | FileCheck --check-prefix=DIR3 %s52# DIR3: (lldb) target create53# DIR3-NEXT: Loading {{.*[/\\]}}dir3{{[/\\]}}a.pdb for {{.*[/\\]}}dir1{{[/\\]}}a.exe54# DIR3: (A) a = (x = 47)55 56# Remove the last PDB in dir3. Now, there's no matching PDB anymore.57# RUN: rm %t/dir3/a.pdb58# RUN: %lldb -S %t/init.input -s %t/check.input -f %t/dir1/a.exe 2>&1 | FileCheck --check-prefix=NOPDB %s59# NOPDB: error: can't find global variable 'a'60 61#--- main.cpp62 63struct A {64 int x = 47;65};66A a;67int main() {}68 69#--- init.input70 71log enable lldb symbol72 73#--- check.input74 75target variable a76q77