xref: /llvm-project/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-print-basic-details.test (revision e7950fceb1e7f82370f6cff80b258e552eb410a6)
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-codeview-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-codeview-clang.o 2>&1 | \
31; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
32
33; ONE:      Logical View:
34; ONE-NEXT: [000]           {File} 'test-codeview-clang.o' -> COFF-x86-64
35; ONE-EMPTY:
36; ONE-NEXT: [001]             {CompileUnit} 'test.cpp'
37; ONE-NEXT: [002]               {Function} extern not_inlined 'foo' -> 'int'
38; ONE-NEXT: [003]                 {Parameter} 'ParamPtr' -> '* const int'
39; ONE-NEXT: [003]                 {Parameter} 'ParamUnsigned' -> 'unsigned'
40; ONE-NEXT: [003]                 {Parameter} 'ParamBool' -> 'bool'
41; ONE-NEXT: [003]                 {Block}
42; ONE-NEXT: [004]                   {Variable} 'CONSTANT' -> 'const int'
43; ONE-NEXT: [004]     5             {Line}
44; ONE-NEXT: [004]                   {Code} 'movl	$0x7, 0x4(%rsp)'
45; ONE-NEXT: [004]     6             {Line}
46; ONE-NEXT: [004]                   {Code} 'movl	$0x7, 0x1c(%rsp)'
47; ONE-NEXT: [004]                   {Code} 'jmp	0x8'
48; ONE-NEXT: [003]                 {TypeAlias} 'INTEGER' -> 'int'
49; ONE-NEXT: [003]     2           {Line}
50; ONE-NEXT: [003]                 {Code} 'subq	$0x20, %rsp'
51; ONE-NEXT: [003]                 {Code} 'andb	$0x1, %r8b'
52; ONE-NEXT: [003]                 {Code} 'movb	%r8b, 0x1b(%rsp)'
53; ONE-NEXT: [003]                 {Code} 'movl	%edx, 0x14(%rsp)'
54; ONE-NEXT: [003]                 {Code} 'movq	%rcx, 0x8(%rsp)'
55; ONE-NEXT: [003]     3           {Line}
56; ONE-NEXT: [003]                 {Code} 'testb	$0x1, 0x1b(%rsp)'
57; ONE-NEXT: [003]                 {Code} 'je	0x15'
58; ONE-NEXT: [003]     8           {Line}
59; ONE-NEXT: [003]                 {Code} 'movl	0x14(%rsp), %eax'
60; ONE-NEXT: [003]                 {Code} 'movl	%eax, 0x1c(%rsp)'
61; ONE-NEXT: [003]     9           {Line}
62; ONE-NEXT: [003]                 {Code} 'movl	0x1c(%rsp), %eax'
63; ONE-NEXT: [003]                 {Code} 'addq	$0x20, %rsp'
64; ONE-NEXT: [003]                 {Code} 'retq'
65; ONE-NEXT: [002]               {TypeAlias} 'INTPTR' -> '* const int'
66