Commit | Line | Data |
---|---|---|
d1fcf2fd | 1 | /* Maintenance commands for testing the settings framework. |
dca0f6c0 PA |
2 | |
3 | Copyright (C) 2019 Free Software Foundation, Inc. | |
4 | ||
5 | This file is part of GDB. | |
6 | ||
7 | This program is free software; you can redistribute it and/or modify | |
8 | it under the terms of the GNU General Public License as published by | |
9 | the Free Software Foundation; either version 3 of the License, or | |
10 | (at your option) any later version. | |
11 | ||
12 | This program is distributed in the hope that it will be useful, | |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | GNU General Public License for more details. | |
16 | ||
17 | You should have received a copy of the GNU General Public License | |
18 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
19 | ||
20 | ||
21 | #include "defs.h" | |
22 | #include "gdbcmd.h" | |
23 | ||
c6ac8931 PA |
24 | /* Command list for "maint set test-settings". */ |
25 | static cmd_list_element *maintenance_set_test_settings_list; | |
dca0f6c0 | 26 | |
c6ac8931 PA |
27 | /* Command list for "maint show test-settings". */ |
28 | static cmd_list_element *maintenance_show_test_settings_list; | |
dca0f6c0 | 29 | |
c6ac8931 | 30 | /* The "maintenance set test-settings" prefix command. */ |
dca0f6c0 PA |
31 | |
32 | static void | |
c6ac8931 | 33 | maintenance_set_test_settings_cmd (const char *args, int from_tty) |
dca0f6c0 | 34 | { |
c6ac8931 | 35 | printf_unfiltered (_("\"maintenance set test-settings\" must be followed " |
dca0f6c0 | 36 | "by the name of a set command.\n")); |
c6ac8931 PA |
37 | help_list (maintenance_set_test_settings_list, |
38 | "maintenance set test-settings ", | |
dca0f6c0 PA |
39 | all_commands, gdb_stdout); |
40 | } | |
41 | ||
c6ac8931 | 42 | /* The "maintenance show test-settings" prefix command. */ |
dca0f6c0 PA |
43 | |
44 | static void | |
c6ac8931 | 45 | maintenance_show_test_settings_cmd (const char *args, int from_tty) |
dca0f6c0 | 46 | { |
c6ac8931 | 47 | cmd_show_list (maintenance_show_test_settings_list, from_tty, ""); |
dca0f6c0 PA |
48 | } |
49 | ||
c6ac8931 | 50 | /* Control variables for all the "maintenance set/show test-settings |
dca0f6c0 PA |
51 | xxx" commands. */ |
52 | ||
491144b5 | 53 | static bool maintenance_test_settings_boolean; |
dca0f6c0 PA |
54 | |
55 | static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO; | |
56 | ||
57 | static unsigned int maintenance_test_settings_uinteger; | |
58 | ||
59 | static int maintenance_test_settings_integer; | |
60 | ||
61 | static int maintenance_test_settings_zinteger; | |
62 | ||
63 | static unsigned int maintenance_test_settings_zuinteger; | |
64 | ||
65 | static int maintenance_test_settings_zuinteger_unlimited; | |
66 | ||
67 | static char *maintenance_test_settings_string; | |
68 | ||
69 | static char *maintenance_test_settings_string_noescape; | |
70 | ||
71 | static char *maintenance_test_settings_optional_filename; | |
72 | ||
73 | static char *maintenance_test_settings_filename; | |
74 | ||
c6ac8931 | 75 | /* Enum values for the "maintenance set/show test-settings boolean" |
dca0f6c0 | 76 | commands. */ |
970f9d09 PA |
77 | static const char maintenance_test_settings_xxx[] = "xxx"; |
78 | static const char maintenance_test_settings_yyy[] = "yyy"; | |
79 | static const char maintenance_test_settings_zzz[] = "zzz"; | |
80 | ||
dca0f6c0 | 81 | static const char *const maintenance_test_settings_enums[] = { |
970f9d09 PA |
82 | maintenance_test_settings_xxx, |
83 | maintenance_test_settings_yyy, | |
84 | maintenance_test_settings_zzz, | |
85 | nullptr | |
dca0f6c0 PA |
86 | }; |
87 | ||
970f9d09 PA |
88 | static const char *maintenance_test_settings_enum |
89 | = maintenance_test_settings_xxx; | |
90 | ||
c6ac8931 | 91 | /* The "maintenance show test-settings xxx" commands. */ |
dca0f6c0 PA |
92 | |
93 | static void | |
c6ac8931 | 94 | maintenance_show_test_settings_value_cmd |
dca0f6c0 PA |
95 | (struct ui_file *file, int from_tty, |
96 | struct cmd_list_element *c, const char *value) | |
97 | { | |
98 | fprintf_filtered (file, (("%s\n")), value); | |
99 | } | |
100 | ||
101 | \f | |
102 | void | |
103 | _initialize_maint_test_settings (void) | |
104 | { | |
970f9d09 PA |
105 | maintenance_test_settings_filename = xstrdup ("/foo/bar"); |
106 | ||
c6ac8931 PA |
107 | add_prefix_cmd ("test-settings", class_maintenance, |
108 | maintenance_set_test_settings_cmd, _("\ | |
dca0f6c0 | 109 | Set GDB internal variables used for set/show command infrastructure testing."), |
c6ac8931 PA |
110 | &maintenance_set_test_settings_list, |
111 | "maintenance set test-settings ", | |
dca0f6c0 | 112 | 0/*allow-unknown*/, |
c6ac8931 | 113 | &maintenance_set_cmdlist); |
dca0f6c0 | 114 | |
c6ac8931 PA |
115 | add_prefix_cmd ("test-settings", class_maintenance, |
116 | maintenance_show_test_settings_cmd, _("\ | |
dca0f6c0 | 117 | Show GDB internal variables used for set/show command infrastructure testing."), |
c6ac8931 PA |
118 | &maintenance_show_test_settings_list, |
119 | "maintenance show test-settings ", | |
dca0f6c0 | 120 | 0/*allow-unknown*/, |
c6ac8931 | 121 | &maintenance_show_cmdlist); |
dca0f6c0 PA |
122 | |
123 | add_setshow_boolean_cmd ("boolean", class_maintenance, | |
124 | &maintenance_test_settings_boolean, _("\ | |
590042fc PW |
125 | command used for internal testing."), _("\ |
126 | command used for internal testing."), | |
dca0f6c0 PA |
127 | nullptr, /* help_doc */ |
128 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
129 | maintenance_show_test_settings_value_cmd, |
130 | &maintenance_set_test_settings_list, | |
131 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
132 | |
133 | add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance, | |
134 | &maintenance_test_settings_auto_boolean, _("\ | |
590042fc PW |
135 | command used for internal testing."), _("\ |
136 | command used for internal testing."), | |
dca0f6c0 PA |
137 | nullptr, /* help_doc */ |
138 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
139 | maintenance_show_test_settings_value_cmd, |
140 | &maintenance_set_test_settings_list, | |
141 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
142 | |
143 | add_setshow_uinteger_cmd ("uinteger", class_maintenance, | |
144 | &maintenance_test_settings_uinteger, _("\ | |
590042fc PW |
145 | command used for internal testing."), _("\ |
146 | command used for internal testing."), | |
c6ac8931 PA |
147 | nullptr, /* help_doc */ |
148 | nullptr, /* set_cmd */ | |
149 | maintenance_show_test_settings_value_cmd, | |
150 | &maintenance_set_test_settings_list, | |
151 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
152 | |
153 | add_setshow_integer_cmd ("integer", class_maintenance, | |
154 | &maintenance_test_settings_integer, _("\ | |
590042fc PW |
155 | command used for internal testing."), _("\ |
156 | command used for internal testing."), | |
dca0f6c0 PA |
157 | nullptr, /* help_doc */ |
158 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
159 | maintenance_show_test_settings_value_cmd, |
160 | &maintenance_set_test_settings_list, | |
161 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
162 | |
163 | add_setshow_string_cmd ("string", class_maintenance, | |
164 | &maintenance_test_settings_string, _("\ | |
590042fc PW |
165 | command used for internal testing."), _("\ |
166 | command used for internal testing."), | |
dca0f6c0 PA |
167 | nullptr, /* help_doc */ |
168 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
169 | maintenance_show_test_settings_value_cmd, |
170 | &maintenance_set_test_settings_list, | |
171 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
172 | |
173 | add_setshow_string_noescape_cmd | |
174 | ("string-noescape", class_maintenance, | |
175 | &maintenance_test_settings_string_noescape, _("\ | |
590042fc PW |
176 | command used for internal testing."), _("\ |
177 | command used for internal testing."), | |
dca0f6c0 PA |
178 | nullptr, /* help_doc */ |
179 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
180 | maintenance_show_test_settings_value_cmd, |
181 | &maintenance_set_test_settings_list, | |
182 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
183 | |
184 | add_setshow_optional_filename_cmd | |
185 | ("optional-filename", class_maintenance, | |
186 | &maintenance_test_settings_optional_filename, _("\ | |
590042fc PW |
187 | command used for internal testing."), _("\ |
188 | command used for internal testing."), | |
dca0f6c0 PA |
189 | nullptr, /* help_doc */ |
190 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
191 | maintenance_show_test_settings_value_cmd, |
192 | &maintenance_set_test_settings_list, | |
193 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
194 | |
195 | add_setshow_filename_cmd ("filename", class_maintenance, | |
196 | &maintenance_test_settings_filename, _("\ | |
590042fc PW |
197 | command used for internal testing."), _("\ |
198 | command used for internal testing."), | |
dca0f6c0 PA |
199 | nullptr, /* help_doc */ |
200 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
201 | maintenance_show_test_settings_value_cmd, |
202 | &maintenance_set_test_settings_list, | |
203 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
204 | |
205 | add_setshow_zinteger_cmd ("zinteger", class_maintenance, | |
206 | &maintenance_test_settings_zinteger, _("\ | |
590042fc PW |
207 | command used for internal testing."), _("\ |
208 | command used for internal testing."), | |
dca0f6c0 PA |
209 | nullptr, /* help_doc */ |
210 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
211 | maintenance_show_test_settings_value_cmd, |
212 | &maintenance_set_test_settings_list, | |
213 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
214 | |
215 | add_setshow_zuinteger_cmd ("zuinteger", class_maintenance, | |
216 | &maintenance_test_settings_zuinteger, _("\ | |
590042fc PW |
217 | command used for internal testing."), _("\ |
218 | command used for internal testing."), | |
dca0f6c0 PA |
219 | nullptr, /* help_doc */ |
220 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
221 | maintenance_show_test_settings_value_cmd, |
222 | &maintenance_set_test_settings_list, | |
223 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
224 | |
225 | add_setshow_zuinteger_unlimited_cmd | |
226 | ("zuinteger-unlimited", class_maintenance, | |
227 | &maintenance_test_settings_zuinteger_unlimited, _("\ | |
590042fc PW |
228 | command used for internal testing."), _("\ |
229 | command used for internal testing."), | |
dca0f6c0 PA |
230 | nullptr, /* help_doc */ |
231 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
232 | maintenance_show_test_settings_value_cmd, |
233 | &maintenance_set_test_settings_list, | |
234 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
235 | |
236 | add_setshow_enum_cmd ("enum", class_maintenance, | |
237 | maintenance_test_settings_enums, | |
238 | &maintenance_test_settings_enum, _("\ | |
590042fc PW |
239 | command used for internal testing."), _("\ |
240 | command used for internal testing."), | |
dca0f6c0 PA |
241 | nullptr, /* help_doc */ |
242 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
243 | maintenance_show_test_settings_value_cmd, |
244 | &maintenance_set_test_settings_list, | |
245 | &maintenance_show_test_settings_list); | |
dca0f6c0 | 246 | } |