1// clang-format off
2// REQUIRES: lld, x86
3
4// Test that lldb load PDB file by command `target symbols add`
5
6// RUN: mkdir -p %t/executable
7// RUN: rm -f %t/executable/foo.exe %t/executable/bar.pdb
8// RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t/executable/foo.obj -- %s
9// RUN: lld-link -debug:full -nodefaultlib -entry:main %t/executable/foo.obj \
10// RUN: -out:%t/executable/foo.exe -pdb:%t/executable/foo.pdb
11// Rename the PDB file so that the name is different from the name inside the executable (foo.exe).
12// RUN: mv %t/executable/foo.pdb %t/executable/bar.pdb
13// RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb %t/executable/foo.exe \
14// RUN: -o "target symbols add %t/executable/bar.pdb" \
15// RUN: -o "b main" \
16// RUN: -o "image dump symfile" -o "quit" | FileCheck %s
17
18int main(int argc, char** argv) {
19 return 0;
20}
21
22// CHECK: (lldb) target symbols add {{.*}}bar.pdb
23// CHECK: symbol file '{{.*}}bar.pdb' has been added to '{{.*}}foo.exe'
24// CHECK: (lldb) b main
25// CHECK: Breakpoint 1: where = foo.exe`main + 21 at load-pdb.cpp:19, address = 0x0000000140001015
26// CHECK: (lldb) image dump symfile
27// CHECK: Types:
28// CHECK: {{.*}}: Type{0x00010024} , size = 0, compiler_type = {{.*}} int (int, char **)
29// CHECK: Compile units:
30// CHECK: {{.*}}: CompileUnit{0x00000000}, language = "c++", file = '{{.*}}load-pdb.cpp'
31// CHECK: {{.*}}: Function{{{.*}}}, demangled = main, type = {{.*}}
32// CHECK: {{.*}}: Block{{{.*}}}
33

source code of lldb/test/Shell/SymbolFile/NativePDB/load-pdb.cpp