llvm/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/02-dwarf-logical-lines.test

; REQUIRES: x86-registered-target

; Test case 2 - Assembler instructions.

; hello-world.cpp
;  1  extern int printf(const char * format, ... );
;  2
;  3  int main()
;  4  {
;  5    printf("Hello, World\n");
;  6    return 0;
;  7  }

; Logical lines.
; The logical views shows the intermixed lines and assembler instructions,
; allowing to compare the code generated by the different toolchains.

; RUN: llvm-debuginfo-analyzer --attribute=level,format,producer \
; RUN:                         --print=lines,instructions \
; RUN:                         %p/Inputs/hello-world-dwarf-clang.o \
; RUN:                         %p/Inputs/hello-world-dwarf-gcc.o 2>&1 | \
; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s

; ONE:      Logical View:
; ONE-NEXT: [000]           {File} 'hello-world-dwarf-clang.o' -> elf64-x86-64
; ONE-EMPTY:
; ONE-NEXT: [001]             {CompileUnit} 'hello-world.cpp'
; ONE-NEXT: [002]               {Producer} 'clang version 15.0.0 {{.*}}'
; ONE-NEXT: [002]     3         {Function} extern not_inlined 'main' -> 'int'
; ONE-NEXT: [003]     4           {Line}
; ONE-NEXT: [003]                 {Code} 'pushq	%rbp'
; ONE-NEXT: [003]                 {Code} 'movq	%rsp, %rbp'
; ONE-NEXT: [003]                 {Code} 'subq	$0x10, %rsp'
; ONE-NEXT: [003]                 {Code} 'movl	$0x0, -0x4(%rbp)'
; ONE-NEXT: [003]     5           {Line}
; ONE-NEXT: [003]                 {Code} 'leaq	(%rip), %rdi'
; ONE-NEXT: [003]                 {Code} 'movb	$0x0, %al'
; ONE-NEXT: [003]                 {Code} 'callq	0x0'
; ONE-NEXT: [003]     6           {Line}
; ONE-NEXT: [003]                 {Code} 'xorl	%eax, %eax'
; ONE-NEXT: [003]                 {Code} 'addq	$0x10, %rsp'
; ONE-NEXT: [003]                 {Code} 'popq	%rbp'
; ONE-NEXT: [003]                 {Code} 'retq'
; ONE-NEXT: [003]     6           {Line}
; ONE-EMPTY:
; ONE-NEXT: Logical View:
; ONE-NEXT: [000]           {File} 'hello-world-dwarf-gcc.o' -> elf64-x86-64
; ONE-EMPTY:
; ONE-NEXT: [001]             {CompileUnit} 'hello-world.cpp'
; ONE-NEXT: [002]               {Producer} 'GNU C++14 10.3.0 {{.*}}'
; ONE-NEXT: [002]     3         {Function} extern not_inlined 'main' -> 'int'
; ONE-NEXT: [003]     4           {Line}
; ONE-NEXT: [003]                 {Code} 'endbr64'
; ONE-NEXT: [003]                 {Code} 'pushq	%rbp'
; ONE-NEXT: [003]                 {Code} 'movq	%rsp, %rbp'
; ONE-NEXT: [003]     5           {Line}
; ONE-NEXT: [003]                 {Code} 'leaq	(%rip), %rdi'
; ONE-NEXT: [003]                 {Code} 'movl	$0x0, %eax'
; ONE-NEXT: [003]                 {Code} 'callq	0x0'
; ONE-NEXT: [003]     6           {Line}
; ONE-NEXT: [003]                 {Code} 'movl	$0x0, %eax'
; ONE-NEXT: [003]     7           {Line}
; ONE-NEXT: [003]                 {Code} 'popq	%rbp'
; ONE-NEXT: [003]                 {Code} 'retq'
; ONE-NEXT: [003]     7           {Line}