xref: /llvm-project/llvm/test/tools/llvm-debuginfo-analyzer/COFF/02-coff-logical-lines.test (revision e7950fceb1e7f82370f6cff80b258e552eb410a6)
1; REQUIRES: x86-registered-target
2
3; Test case 2 - Assembler instructions.
4
5; hello-world.cpp
6;  1  extern int printf(const char * format, ... );
7;  2
8;  3  int main()
9;  4  {
10;  5    printf("Hello, World\n");
11;  6    return 0;
12;  7  }
13
14; Logical lines.
15; The logical views shows the intermixed lines and assembler instructions,
16; allowing to compare the code generated by the different toolchains.
17
18; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
19; RUN:                         --print=lines,instructions \
20; RUN:                         %p/Inputs/hello-world-codeview-clang.o \
21; RUN:                         %p/Inputs/hello-world-codeview-msvc.o 2>&1 | \
22; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
23
24; ONE:      Logical View:
25; ONE-NEXT: [000]           {File} 'hello-world-codeview-clang.o' -> COFF-x86-64
26; ONE-EMPTY:
27; ONE-NEXT: [001]             {CompileUnit} 'hello-world.cpp'
28; ONE-NEXT: [002]               {Producer} 'clang version 15.0.0 {{.*}}'
29; ONE-NEXT: [002]               {Function} extern not_inlined 'main' -> 'int'
30; ONE-NEXT: [003]     4           {Line}
31; ONE-NEXT: [003]                 {Code} 'subq	$0x28, %rsp'
32; ONE-NEXT: [003]                 {Code} 'movl	$0x0, 0x24(%rsp)'
33; ONE-NEXT: [003]     5           {Line}
34; ONE-NEXT: [003]                 {Code} 'leaq	(%rip), %rcx'
35; ONE-NEXT: [003]                 {Code} 'callq	0x0'
36; ONE-NEXT: [003]     6           {Line}
37; ONE-NEXT: [003]                 {Code} 'xorl	%eax, %eax'
38; ONE-NEXT: [003]                 {Code} 'addq	$0x28, %rsp'
39; ONE-NEXT: [003]                 {Code} 'retq'
40; ONE-EMPTY:
41; ONE-NEXT: Logical View:
42; ONE-NEXT: [000]           {File} 'hello-world-codeview-msvc.o' -> COFF-x86-64
43; ONE-EMPTY:
44; ONE-NEXT: [001]             {CompileUnit} 'hello-world.cpp'
45; ONE-NEXT: [002]               {Producer} 'Microsoft (R) Optimizing Compiler'
46; ONE-NEXT: [002]               {Function} extern not_inlined 'main' -> 'int'
47; ONE-NEXT: [003]     4           {Line}
48; ONE-NEXT: [003]                 {Code} 'subq	$0x28, %rsp'
49; ONE-NEXT: [003]     5           {Line}
50; ONE-NEXT: [003]                 {Code} 'leaq	(%rip), %rcx'
51; ONE-NEXT: [003]                 {Code} 'callq	0x0'
52; ONE-NEXT: [003]     6           {Line}
53; ONE-NEXT: [003]                 {Code} 'xorl	%eax, %eax'
54; ONE-NEXT: [003]     7           {Line}
55; ONE-NEXT: [003]                 {Code} 'addq	$0x28, %rsp'
56; ONE-NEXT: [003]                 {Code} 'retq'
57