xref: /llvm-project/llvm/test/tools/llvm-debuginfo-analyzer/DWARF/01-dwarf-print-basic-details.test (revision d858447584a0dc41ecdee7c92bb5e8b7f52e3ff0)
1; REQUIRES: x86-registered-target
2
3; Test case 1 - General options.
4
5; test.cpp
6;  1  using INTPTR = const int *;
7;  2  int foo(INTPTR ParamPtr, unsigned ParamUnsigned, bool ParamBool) {
8;  3    if (ParamBool) {
9;  4      typedef int INTEGER;
10;  5      const INTEGER CONSTANT = 7;
11;  6      return CONSTANT;
12;  7    }
13;  8    return ParamUnsigned;
14;  9  }
15
16; Print basic details.
17; The following command prints basic details for all the logical elements
18; sorted by the debug information internal offset; it includes its lexical
19; level and debug info format.
20
21; RUN: llvm-debuginfo-analyzer --attribute=level,format \
22; RUN:                         --output-sort=offset \
23; RUN:                         --print=scopes,symbols,types,lines,instructions \
24; RUN:                         %p/Inputs/test-dwarf-clang.o 2>&1 | \
25; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
26
27; RUN: llvm-debuginfo-analyzer --attribute=level,format \
28; RUN:                         --output-sort=offset \
29; RUN:                         --print=elements \
30; RUN:                         %p/Inputs/test-dwarf-clang.o 2>&1 | \
31; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
32
33; ONE:      Logical View:
34; ONE-NEXT: [000]           {File} 'test-dwarf-clang.o' -> elf64-x86-64
35; ONE-EMPTY:
36; ONE-NEXT: [001]             {CompileUnit} 'test.cpp'
37; ONE-NEXT: [002]     2         {Function} extern not_inlined 'foo' -> 'int'
38; ONE-NEXT: [003]     2           {Parameter} 'ParamPtr' -> 'INTPTR'
39; ONE-NEXT: [003]     2           {Parameter} 'ParamUnsigned' -> 'unsigned int'
40; ONE-NEXT: [003]     2           {Parameter} 'ParamBool' -> 'bool'
41; ONE-NEXT: [003]                 {Block}
42; ONE-NEXT: [004]     5             {Variable} 'CONSTANT' -> 'const INTEGER'
43; ONE-NEXT: [004]     5             {Line}
44; ONE-NEXT: [004]                   {Code} 'movl	$0x7, -0x1c(%rbp)'
45; ONE-NEXT: [004]     6             {Line}
46; ONE-NEXT: [004]                   {Code} 'movl	$0x7, -0x4(%rbp)'
47; ONE-NEXT: [004]                   {Code} 'jmp	0x6'
48; ONE-NEXT: [004]     8             {Line}
49; ONE-NEXT: [004]                   {Code} 'movl	-0x14(%rbp), %eax'
50; ONE-NEXT: [003]     4           {TypeAlias} 'INTEGER' -> 'int'
51; ONE-NEXT: [003]     2           {Line}
52; ONE-NEXT: [003]                 {Code} 'pushq	%rbp'
53; ONE-NEXT: [003]                 {Code} 'movq	%rsp, %rbp'
54; ONE-NEXT: [003]                 {Code} 'movb	%dl, %al'
55; ONE-NEXT: [003]                 {Code} 'movq	%rdi, -0x10(%rbp)'
56; ONE-NEXT: [003]                 {Code} 'movl	%esi, -0x14(%rbp)'
57; ONE-NEXT: [003]                 {Code} 'andb	$0x1, %al'
58; ONE-NEXT: [003]                 {Code} 'movb	%al, -0x15(%rbp)'
59; ONE-NEXT: [003]     3           {Line}
60; ONE-NEXT: [003]                 {Code} 'testb	$0x1, -0x15(%rbp)'
61; ONE-NEXT: [003]                 {Code} 'je	0x13'
62; ONE-NEXT: [003]     8           {Line}
63; ONE-NEXT: [003]                 {Code} 'movl	%eax, -0x4(%rbp)'
64; ONE-NEXT: [003]     9           {Line}
65; ONE-NEXT: [003]                 {Code} 'movl	-0x4(%rbp), %eax'
66; ONE-NEXT: [003]                 {Code} 'popq	%rbp'
67; ONE-NEXT: [003]                 {Code} 'retq'
68; ONE-NEXT: [003]     9           {Line}
69; ONE-NEXT: [002]     1         {TypeAlias} 'INTPTR' -> '* const int'
70