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