]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.python/py-completion.py
GDB copyright headers update after running GDB's copyright.py script.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-completion.py
1 # Copyright (C) 2014-2016 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 class CompleteFileInit(gdb.Command):
21 def __init__(self):
22 gdb.Command.__init__(self,'completefileinit',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)
23
24 def invoke(self,argument,from_tty):
25 raise gdb.GdbError('not implemented')
26
27 class CompleteFileMethod(gdb.Command):
28 def __init__(self):
29 gdb.Command.__init__(self,'completefilemethod',gdb.COMMAND_USER)
30
31 def invoke(self,argument,from_tty):
32 raise gdb.GdbError('not implemented')
33
34 def complete(self,text,word):
35 return gdb.COMPLETE_FILENAME
36
37 class CompleteFileCommandCond(gdb.Command):
38 def __init__(self):
39 gdb.Command.__init__(self,'completefilecommandcond',gdb.COMMAND_USER)
40
41 def invoke(self,argument,from_tty):
42 raise gdb.GdbError('not implemented')
43
44 def complete(self,text,word):
45 # This is a test made to know if the command
46 # completion still works fine. When the user asks to
47 # complete something like "completefilecommandcond
48 # /path/to/py-completion-t", it should not complete to
49 # "/path/to/py-completion-test/", but instead just
50 # wait for input.
51 if "py-completion-t" in text:
52 return gdb.COMPLETE_COMMAND
53 else:
54 return gdb.COMPLETE_FILENAME
55
56 class CompleteLimit1(gdb.Command):
57 def __init__(self):
58 gdb.Command.__init__(self,'completelimit1',gdb.COMMAND_USER)
59
60 def invoke(self,argument,from_tty):
61 raise gdb.GdbError('not implemented')
62
63 def complete(self,text,word):
64 return ["cl11", "cl12", "cl13"]
65
66 class CompleteLimit2(gdb.Command):
67 def __init__(self):
68 gdb.Command.__init__(self,'completelimit2',
69 gdb.COMMAND_USER)
70
71 def invoke(self,argument,from_tty):
72 raise gdb.GdbError('not implemented')
73
74 def complete(self,text,word):
75 return ["cl21", "cl23", "cl25", "cl27", "cl29",
76 "cl22", "cl24", "cl26", "cl28", "cl210"]
77
78 class CompleteLimit3(gdb.Command):
79 def __init__(self):
80 gdb.Command.__init__(self,'completelimit3',
81 gdb.COMMAND_USER)
82
83 def invoke(self,argument,from_tty):
84 raise gdb.GdbError('not implemented')
85
86 def complete(self,text,word):
87 return ["cl31", "cl33", "cl35", "cl37", "cl39",
88 "cl32", "cl34", "cl36", "cl38", "cl310"]
89
90 class CompleteLimit4(gdb.Command):
91 def __init__(self):
92 gdb.Command.__init__(self,'completelimit4',
93 gdb.COMMAND_USER)
94
95 def invoke(self,argument,from_tty):
96 raise gdb.GdbError('not implemented')
97
98 def complete(self,text,word):
99 return ["cl41", "cl43", "cl45", "cl47", "cl49",
100 "cl42", "cl44", "cl46", "cl48", "cl410"]
101
102 class CompleteLimit5(gdb.Command):
103 def __init__(self):
104 gdb.Command.__init__(self,'completelimit5',
105 gdb.COMMAND_USER)
106
107 def invoke(self,argument,from_tty):
108 raise gdb.GdbError('not implemented')
109
110 def complete(self,text,word):
111 return ["cl51", "cl53", "cl55", "cl57", "cl59",
112 "cl52", "cl54", "cl56", "cl58", "cl510"]
113
114 class CompleteLimit6(gdb.Command):
115 def __init__(self):
116 gdb.Command.__init__(self,'completelimit6',
117 gdb.COMMAND_USER)
118
119 def invoke(self,argument,from_tty):
120 raise gdb.GdbError('not implemented')
121
122 def complete(self,text,word):
123 return ["cl61", "cl63", "cl65", "cl67", "cl69",
124 "cl62", "cl64", "cl66", "cl68", "cl610"]
125
126 class CompleteLimit7(gdb.Command):
127 def __init__(self):
128 gdb.Command.__init__(self,'completelimit7',
129 gdb.COMMAND_USER)
130
131 def invoke(self,argument,from_tty):
132 raise gdb.GdbError('not implemented')
133
134 def complete(self,text,word):
135 return ["cl71", "cl73", "cl75", "cl77", "cl79",
136 "cl72", "cl74", "cl76", "cl78", "cl710"]
137
138 CompleteFileInit()
139 CompleteFileMethod()
140 CompleteFileCommandCond()
141 CompleteLimit1()
142 CompleteLimit2()
143 CompleteLimit3()
144 CompleteLimit4()
145 CompleteLimit5()
146 CompleteLimit6()
147 CompleteLimit7()