1 | // clang-format off |
2 | // REQUIRES: lld, x86 |
3 | |
4 | // Test that we can show disassembly and source. |
5 | // RUN: %clang_cl --target=x86_64-windows-msvc -Od -Z7 -c /Fo%t.obj -- %s |
6 | // RUN: lld-link -debug:full -nodefaultlib -entry:main %t.obj -out:%t.exe -pdb:%t.pdb |
7 | // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ |
8 | // RUN: %p/Inputs/disassembly.lldbinit | FileCheck %s |
9 | |
10 | // Some context lines before the function. |
11 | |
12 | int foo() { return 42; } |
13 | |
14 | int main(int argc, char **argv) { |
15 | foo(); |
16 | return 0; |
17 | } |
18 | |
19 | |
20 | // CHECK: (lldb) disassemble --flavor=intel -m -n main |
21 | // CHECK: 12 int foo() { return 42; } |
22 | // CHECK-NEXT: 13 |
23 | // CHECK-NEXT: ** 14 int main(int argc, char **argv) { |
24 | // CHECK: disassembly.cpp.tmp.exe`main: |
25 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+0>: sub rsp, 0x38 |
26 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+4>: mov dword ptr [rsp + 0x34], 0x0 |
27 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+12>: mov qword ptr [rsp + 0x28], rdx |
28 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+17>: mov dword ptr [rsp + 0x24], ecx |
29 | // CHECK: ** 15 foo(); |
30 | // CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+21>: call {{.*}} ; foo at disassembly.cpp:12 |
31 | // CHECK: ** 16 return 0; |
32 | // CHECK-NEXT: 17 } |
33 | // CHECK-NEXT: 18 |
34 | // CHECK: disassembly.cpp.tmp.exe[{{.*}}] <+26>: xor eax, eax |
35 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+28>: add rsp, 0x38 |
36 | // CHECK-NEXT: disassembly.cpp.tmp.exe[{{.*}}] <+32>: ret |
37 | |