summaryrefslogtreecommitdiff
path: root/cross-project-tests/debuginfo-tests/llvm-prettyprinters/gdb/llvm-support.gdb
blob: 6222ab84ed8ca7e55ce40f759e8abe1a6f04d78a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# RUN: gdb -q -batch -n -iex 'source %llvm_src_root/utils/gdb-scripts/prettyprinters.py' -x %s %llvm_tools_dir/check-gdb-llvm-support | FileCheck %s
# REQUIRES: debug-info

break main
run

# CHECK: llvm::ArrayRef of length 3 = {1, 2, 3}
p ArrayRef

# CHECK: llvm::ArrayRef of length 3 = {1, 2, 3}
p MutableArrayRef

# CHECK: llvm::DenseMap with 2 elements = {
# CHECK:   [4] = 5,
# CHECK:   [6] = 7,
# CHECK: }
p DenseMap

# CHECK: llvm::Expected = {value = 8}
p ExpectedValue

# CHECK: llvm::Expected is error
p ExpectedError

# CHECK: llvm::Optional = {value = 9}
p OptionalValue

# CHECK: llvm::Optional is not initialized
p OptionalNone

# CHECK: llvm::SmallVector of Size 3, Capacity 5 = {10, 11, 12}
p SmallVector

# CHECK: "foo"
p SmallString

# CHECK: "bar"
p StringRef

# CHECK: "foobarbaz"
p Twine

# CHECK: llvm::StringMap with 2 elements = {["foo"] = 123, ["bar"] = 456}
py import sys
py gdb.execute("p StringMap" if sys.version_info.major > 2 else "printf \"llvm::StringMap with 2 elements = {[\\\"foo\\\"] = 123, [\\\"bar\\\"] = 456}\"\n\n")

# CHECK: {pointer = 0xabc, value = 1}
p PointerIntPair

# CHECK: Containing int * = {pointer = 0xabc}
p PointerUnion

# CHECK: PointerUnionMembers<llvm::PointerUnion<Z*, float*>,
p RawPrintingPointerUnion

# Switch to print pretty adds newlines to the following statements.
set print pretty

# CHECK: {
# CHECK:   [0] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Ilist_Sentinel:0x.*]] <Ilist>,
# CHECK:       next = [[Node_14:0x.*]]
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[Node_14]],
# CHECK:       next = [[SimpleIlist_Sentinel:0x.*]] <SimpleIlist>
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 13
# CHECK:   },
# CHECK:   [1] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Node_13:0x.*]],
# CHECK:       next = [[Node_15:0x.*]]
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[Node_15]],
# CHECK:       next = [[Node_13]]
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 14
# CHECK:   },
# CHECK:   [2] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Node_14]],
# CHECK:       next = [[Ilist_Sentinel]] <Ilist>
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
# CHECK:       next = [[Node_14]]
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 15
# CHECK:   }
# CHECK: }
p Ilist

# CHECK: {
# CHECK:   [0] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Node_14]],
# CHECK:       next = [[Ilist_Sentinel]] <Ilist>
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[SimpleIlist_Sentinel]] <SimpleIlist>,
# CHECK:       next = [[Node_14]]
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 15
# CHECK:   },
# CHECK:   [1] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Node_13]],
# CHECK:       next = [[Node_15]]
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[Node_15]],
# CHECK:       next = [[Node_13]]
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 14
# CHECK:   },
# CHECK:   [2] = {
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<A> >> = {
# CHECK:       prev = [[Ilist_Sentinel]] <Ilist>,
# CHECK:       next = [[Node_14]]
# CHECK:     },
# CHECK:     <llvm::ilist_node<IlistNode, llvm::ilist_tag<B> >> = {
# CHECK:       prev = [[Node_14]],
# CHECK:       next = [[SimpleIlist_Sentinel]] <SimpleIlist>
# CHECK:     },
# CHECK:     members of IlistNode:
# CHECK:     Value = 13
# CHECK:   }
# CHECK: }
p SimpleIlist