68 lines · plain
1; REQUIRES: x86-registered-target2 3; Test case 2 - Assembler instructions.4 5; hello-world.cpp6; 1 extern int printf(const char * format, ... );7; 28; 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=language,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 %s23 24; ONE: Logical View:25; ONE-NEXT: [000] {File} 'hello-world-dwarf-clang.o' -> elf64-x86-6426; ONE-EMPTY:27; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'28; ONE-NEXT: [002] {Producer} 'clang version 15.0.0 {{.*}}'29; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus_14'30; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'31; ONE-NEXT: [003] 4 {Line}32; ONE-NEXT: [003] {Code} 'pushq %rbp'33; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'34; ONE-NEXT: [003] {Code} 'subq $0x10, %rsp'35; ONE-NEXT: [003] {Code} 'movl $0x0, -0x4(%rbp)'36; ONE-NEXT: [003] 5 {Line}37; ONE-NEXT: [003] {Code} 'leaq (%rip), %rdi'38; ONE-NEXT: [003] {Code} 'movb $0x0, %al'39; ONE-NEXT: [003] {Code} 'callq 0x0'40; ONE-NEXT: [003] 6 {Line}41; ONE-NEXT: [003] {Code} 'xorl %eax, %eax'42; ONE-NEXT: [003] {Code} 'addq $0x10, %rsp'43; ONE-NEXT: [003] {Code} 'popq %rbp'44; ONE-NEXT: [003] {Code} 'retq'45; ONE-NEXT: [002] 6 {Line}46; ONE-EMPTY:47; ONE-NEXT: Logical View:48; ONE-NEXT: [000] {File} 'hello-world-dwarf-gcc.o' -> elf64-x86-6449; ONE-EMPTY:50; ONE-NEXT: [001] {CompileUnit} 'hello-world.cpp'51; ONE-NEXT: [002] {Producer} 'GNU C++14 10.3.0 {{.*}}'52; ONE-NEXT: [002] {Language} 'DW_LANG_C_plus_plus'53; ONE-NEXT: [002] 3 {Function} extern not_inlined 'main' -> 'int'54; ONE-NEXT: [003] 4 {Line}55; ONE-NEXT: [003] {Code} 'endbr64'56; ONE-NEXT: [003] {Code} 'pushq %rbp'57; ONE-NEXT: [003] {Code} 'movq %rsp, %rbp'58; ONE-NEXT: [003] 5 {Line}59; ONE-NEXT: [003] {Code} 'leaq (%rip), %rdi'60; ONE-NEXT: [003] {Code} 'movl $0x0, %eax'61; ONE-NEXT: [003] {Code} 'callq 0x0'62; ONE-NEXT: [003] 6 {Line}63; ONE-NEXT: [003] {Code} 'movl $0x0, %eax'64; ONE-NEXT: [003] 7 {Line}65; ONE-NEXT: [003] {Code} 'popq %rbp'66; ONE-NEXT: [003] {Code} 'retq'67; ONE-NEXT: [002] 7 {Line}68