xref: /llvm-project/llvm/test/tools/llvm-debuginfo-analyzer/COFF/01-coff-select-logical-elements.test (revision c5ce3b136cfaafd656dbce3665b1d6a39845fa88)
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; Select logical elements.
17; The following prints all 'instructions', 'symbols' and 'types' that
18; contain 'inte' or 'movl' in their names or types, using a tab layout
19; and given the number of matches.
20
21; RUN: llvm-debuginfo-analyzer --attribute=level \
22; RUN:                         --select-nocase --select-regex \
23; RUN:                         --select=INTe --select=movl \
24; RUN:                         --report=list \
25; RUN:                         --print=symbols,types,instructions,summary \
26; RUN:                         %p/Inputs/test-codeview-clang.o 2>&1 | \
27; RUN: FileCheck --strict-whitespace -check-prefix=ONE %s
28
29; ONE:      Logical View:
30; ONE-NEXT: [000]           {File} 'test-codeview-clang.o'
31; ONE-EMPTY:
32; ONE-NEXT: [001]           {CompileUnit} 'test.cpp'
33; ONE-NEXT: [003]           {TypeAlias} 'INTEGER' -> 'int'
34; ONE-NEXT: [004]           {Code} 'movl	$0x7, 0x1c(%rsp)'
35; ONE-NEXT: [004]           {Code} 'movl	$0x7, 0x4(%rsp)'
36; ONE-NEXT: [003]           {Code} 'movl	%eax, 0x1c(%rsp)'
37; ONE-NEXT: [003]           {Code} 'movl	%edx, 0x14(%rsp)'
38; ONE-NEXT: [003]           {Code} 'movl	0x14(%rsp), %eax'
39; ONE-NEXT: [003]           {Code} 'movl	0x1c(%rsp), %eax'
40; ONE-EMPTY:
41; ONE-NEXT: -----------------------------
42; ONE-NEXT: Element      Total    Printed
43; ONE-NEXT: -----------------------------
44; ONE-NEXT: Scopes           3          0
45; ONE-NEXT: Symbols          4          0
46; ONE-NEXT: Types            2          1
47; ONE-NEXT: Lines           21          6
48; ONE-NEXT: -----------------------------
49; ONE-NEXT: Total           30          7
50
51; RUN: llvm-debuginfo-analyzer --attribute=level \
52; RUN:                         --select-regex --select-nocase \
53; RUN:                         --select=INTe \
54; RUN:                         --report=list \
55; RUN:                         --print=symbols,types \
56; RUN:                         %p/Inputs/test-codeview-clang.o \
57; RUN:                         %p/Inputs/test-codeview-msvc.o 2>&1 | \
58; RUN: FileCheck --strict-whitespace -check-prefix=TWO %s
59
60; TWO:      Logical View:
61; TWO-NEXT: [000]           {File} 'test-codeview-clang.o'
62; TWO-EMPTY:
63; TWO-NEXT: [001]           {CompileUnit} 'test.cpp'
64; TWO-NEXT: [003]           {TypeAlias} 'INTEGER' -> 'int'
65; TWO-EMPTY:
66; TWO-NEXT: Logical View:
67; TWO-NEXT: [000]           {File} 'test-codeview-msvc.o'
68; TWO-EMPTY:
69; TWO-NEXT: [001]           {CompileUnit} 'test.cpp'
70; TWO-NEXT: [004]           {TypeAlias} 'INTEGER' -> 'int'
71
72; Select logical elements by matching linkage names.
73; The following prints all symbols that
74; contain "?foo@@YAHPEBHI_N@Z" in their linkage names, using a tab layout
75; and given the number of matches.
76
77; RUN: llvm-debuginfo-analyzer --attribute=level \
78; RUN:                         --select=?foo@@YAHPEBHI_N@Z \
79; RUN:                         --report=list \
80; RUN:                         --print=symbols \
81; RUN:                         %p/Inputs/test-codeview-clang.o \
82; RUN:                         %p/Inputs/test-codeview-msvc.o 2>&1 | \
83; RUN: FileCheck --strict-whitespace -check-prefix=THREE %s
84
85; THREE:      Logical View:
86; THREE-NEXT: [000]           {File} 'test-codeview-clang.o'
87; THREE-EMPTY:
88; THREE-NEXT: [001]           {CompileUnit} 'test.cpp'
89; THREE-NEXT: [002]           {Function} extern not_inlined 'foo' -> 'int'
90; THREE-EMPTY:
91; THREE:      Logical View:
92; THREE-NEXT: [000]           {File} 'test-codeview-msvc.o'
93; THREE-EMPTY:
94; THREE-NEXT: [001]           {CompileUnit} 'test.cpp'
95; THREE-NEXT: [002]           {Function} extern not_inlined 'foo' -> 'int'
96