1 ; REQUIRES: x86-registered-target
3 ; Test case 2 - Assembler instructions.
6 ; 1 extern int printf(const char * format, ... );
10 ; 5 printf("Hello, World\n");
15 ; The logical views shows the intermixed lines and assembler instructions,
16 ; allowing to compare the code generated by the different toolchains.
18 ; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
19 ; RUN: --print=lines,instructions \
20 ; RUN: %p/Inputs/hello-world-dwarf-clang.o \
21 ; RUN: %p/Inputs/hello-world-dwarf-gcc.o 2>&1 | \
22 ; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
25 ; ONE-NEXT: [000] {File} 'hello-world-dwarf-clang.o' -> elf64-x86-64
27 ; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
28 ; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'
29 ; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'
30 ; ONE-NEXT: [003] 4 {Line}
31 ; ONE-NEXT: [003] {Code} 'pushq %rbp'
32 ; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'
33 ; ONE-NEXT: [003] {Code} 'subq $0x10, %rsp'
34 ; ONE-NEXT: [003] {Code} 'movl $0x0, -0x4(%rbp)'
35 ; ONE-NEXT: [003] 5 {Line}
36 ; ONE-NEXT: [003] {Code} 'leaq (%rip), %rdi'
37 ; ONE-NEXT: [003] {Code} 'movb $0x0, %al'
38 ; ONE-NEXT: [003] {Code} 'callq 0x0'
39 ; ONE-NEXT: [003] 6 {Line}
40 ; ONE-NEXT: [003] {Code} 'xorl %eax, %eax'
41 ; ONE-NEXT: [003] {Code} 'addq $0x10, %rsp'
42 ; ONE-NEXT: [003] {Code} 'popq %rbp'
43 ; ONE-NEXT: [003] {Code} 'retq'
44 ; ONE-NEXT: [003] 6 {Line}
46 ; ONE-NEXT: Logical View:
47 ; ONE-NEXT: [000] {File} 'hello-world-dwarf-gcc.o' -> elf64-x86-64
49 ; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'
50 ; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'
51 ; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'
52 ; ONE-NEXT: [003] 4 {Line}
53 ; ONE-NEXT: [003] {Code} 'endbr64'
54 ; ONE-NEXT: [003] {Code} 'pushq %rbp'
55 ; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'
56 ; ONE-NEXT: [003] 5 {Line}
57 ; ONE-NEXT: [003] {Code} 'leaq (%rip), %rdi'
58 ; ONE-NEXT: [003] {Code} 'movl $0x0, %eax'
59 ; ONE-NEXT: [003] {Code} 'callq 0x0'
60 ; ONE-NEXT: [003] 6 {Line}
61 ; ONE-NEXT: [003] {Code} 'movl $0x0, %eax'
62 ; ONE-NEXT: [003] 7 {Line}
63 ; ONE-NEXT: [003] {Code} 'popq %rbp'
64 ; ONE-NEXT: [003] {Code} 'retq'
65 ; ONE-NEXT: [003] 7 {Line}