a34c3a7245d717b0ff4377adeacf1bc0a72ad024
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-completion.py
1 # Copyright (C) 2014-2021 Free Software Foundation, Inc.
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
13 # You should have received a copy of the GNU General Public License
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15
16 # This testcase tests PR python/16699
17
18 import gdb
19
20
21 class CompleteFileInit(gdb.Command):
22 def __init__(self):
23 gdb.Command.__init__(
24 self, "completefileinit", gdb.COMMAND_USER, gdb.COMPLETE_FILENAME
25 )
26
27 def invoke(self, argument, from_tty):
28 raise gdb.GdbError("not implemented")
29
30
31 class CompleteFileMethod(gdb.Command):
32 def __init__(self):
33 gdb.Command.__init__(self, "completefilemethod", gdb.COMMAND_USER)
34
35 def invoke(self, argument, from_tty):
36 raise gdb.GdbError("not implemented")
37
38 def complete(self, text, word):
39 return gdb.COMPLETE_FILENAME
40
41
42 class CompleteFileCommandCond(gdb.Command):
43 def __init__(self):
44 gdb.Command.__init__(self, "completefilecommandcond", gdb.COMMAND_USER)
45
46 def invoke(self, argument, from_tty):
47 raise gdb.GdbError("not implemented")
48
49 def complete(self, text, word):
50 # This is a test made to know if the command
51 # completion still works fine. When the user asks to
52 # complete something like "completefilecommandcond
53 # /path/to/py-completion-t", it should not complete to
54 # "/path/to/py-completion-test/", but instead just
55 # wait for input.
56 if "py-completion-t" in text:
57 return gdb.COMPLETE_COMMAND
58 else:
59 return gdb.COMPLETE_FILENAME
60
61
62 class CompleteLimit1(gdb.Command):
63 def __init__(self):
64 gdb.Command.__init__(self, "completelimit1", gdb.COMMAND_USER)
65
66 def invoke(self, argument, from_tty):
67 raise gdb.GdbError("not implemented")
68
69 def complete(self, text, word):
70 return ["cl11", "cl12", "cl13"]
71
72
73 class CompleteLimit2(gdb.Command):
74 def __init__(self):
75 gdb.Command.__init__(self, "completelimit2", gdb.COMMAND_USER)
76
77 def invoke(self, argument, from_tty):
78 raise gdb.GdbError("not implemented")
79
80 def complete(self, text, word):
81 return [
82 "cl21",
83 "cl23",
84 "cl25",
85 "cl27",
86 "cl29",
87 "cl22",
88 "cl24",
89 "cl26",
90 "cl28",
91 "cl210",
92 ]
93
94
95 class CompleteLimit3(gdb.Command):
96 def __init__(self):
97 gdb.Command.__init__(self, "completelimit3", gdb.COMMAND_USER)
98
99 def invoke(self, argument, from_tty):
100 raise gdb.GdbError("not implemented")
101
102 def complete(self, text, word):
103 return [
104 "cl31",
105 "cl33",
106 "cl35",
107 "cl37",
108 "cl39",
109 "cl32",
110 "cl34",
111 "cl36",
112 "cl38",
113 "cl310",
114 ]
115
116
117 class CompleteLimit4(gdb.Command):
118 def __init__(self):
119 gdb.Command.__init__(self, "completelimit4", gdb.COMMAND_USER)
120
121 def invoke(self, argument, from_tty):
122 raise gdb.GdbError("not implemented")
123
124 def complete(self, text, word):
125 return [
126 "cl41",
127 "cl43",
128 "cl45",
129 "cl47",
130 "cl49",
131 "cl42",
132 "cl44",
133 "cl46",
134 "cl48",
135 "cl410",
136 ]
137
138
139 class CompleteLimit5(gdb.Command):
140 def __init__(self):
141 gdb.Command.__init__(self, "completelimit5", gdb.COMMAND_USER)
142
143 def invoke(self, argument, from_tty):
144 raise gdb.GdbError("not implemented")
145
146 def complete(self, text, word):
147 return [
148 "cl51",
149 "cl53",
150 "cl55",
151 "cl57",
152 "cl59",
153 "cl52",
154 "cl54",
155 "cl56",
156 "cl58",
157 "cl510",
158 ]
159
160
161 class CompleteLimit6(gdb.Command):
162 def __init__(self):
163 gdb.Command.__init__(self, "completelimit6", gdb.COMMAND_USER)
164
165 def invoke(self, argument, from_tty):
166 raise gdb.GdbError("not implemented")
167
168 def complete(self, text, word):
169 return [
170 "cl61",
171 "cl63",
172 "cl65",
173 "cl67",
174 "cl69",
175 "cl62",
176 "cl64",
177 "cl66",
178 "cl68",
179 "cl610",
180 ]
181
182
183 class CompleteLimit7(gdb.Command):
184 def __init__(self):
185 gdb.Command.__init__(self, "completelimit7", gdb.COMMAND_USER)
186
187 def invoke(self, argument, from_tty):
188 raise gdb.GdbError("not implemented")
189
190 def complete(self, text, word):
191 return [
192 "cl71",
193 "cl73",
194 "cl75",
195 "cl77",
196 "cl79",
197 "cl72",
198 "cl74",
199 "cl76",
200 "cl78",
201 "cl710",
202 ]
203
204
205 CompleteFileInit()
206 CompleteFileMethod()
207 CompleteFileCommandCond()
208 CompleteLimit1()
209 CompleteLimit2()
210 CompleteLimit3()
211 CompleteLimit4()
212 CompleteLimit5()
213 CompleteLimit6()
214 CompleteLimit7()
This page took 0.033268 seconds and 3 git commands to generate.