1 /* Support for GDB maintenance commands.
3 Copyright (C) 2019 Free Software Foundation, Inc.
5 This file is part of GDB.
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.
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.
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/>. */
24 /* Command list for "maint test-settings". */
25 static cmd_list_element *maintenance_test_settings_list;
27 /* Command list for "maint test-settings set/show". */
28 static cmd_list_element *maintenance_test_settings_set_list;
29 static cmd_list_element *maintenance_test_settings_show_list;
31 /* The "maintenance test-options" prefix command. */
34 maintenance_test_settings_cmd (const char *arg, int from_tty)
37 (_("\"maintenance test-settings\" must be followed "
38 "by the name of a subcommand.\n"));
39 help_list (maintenance_test_settings_list, "maintenance test-settings ",
40 all_commands, gdb_stdout);
43 /* The "maintenance test-options set" prefix command. */
46 maintenance_test_settings_set_cmd (const char *args, int from_tty)
48 printf_unfiltered (_("\"maintenance test-settings set\" must be followed "
49 "by the name of a set command.\n"));
50 help_list (maintenance_test_settings_set_list,
51 "maintenance test-settings set ",
52 all_commands, gdb_stdout);
55 /* The "maintenance test-options show" prefix command. */
58 maintenance_test_settings_show_cmd (const char *args, int from_tty)
60 cmd_show_list (maintenance_test_settings_show_list, from_tty, "");
63 /* Control variables for all the "maintenance test-options set/show
66 static int maintenance_test_settings_boolean;
68 static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO;
70 static unsigned int maintenance_test_settings_uinteger;
72 static int maintenance_test_settings_integer;
74 static int maintenance_test_settings_zinteger;
76 static unsigned int maintenance_test_settings_zuinteger;
78 static int maintenance_test_settings_zuinteger_unlimited;
80 static char *maintenance_test_settings_string;
82 static char *maintenance_test_settings_string_noescape;
84 static char *maintenance_test_settings_optional_filename;
86 static char *maintenance_test_settings_filename;
88 static const char *maintenance_test_settings_enum;
90 /* Enum values for the "maintenance test-settings set/show boolean"
92 static const char *const maintenance_test_settings_enums[] = {
93 "xxx", "yyy", "zzz", nullptr
96 /* The "maintenance test-options show xxx" commands. */
99 maintenance_test_settings_show_value_cmd
100 (struct ui_file *file, int from_tty,
101 struct cmd_list_element *c, const char *value)
103 fprintf_filtered (file, (("%s\n")), value);
108 _initialize_maint_test_settings (void)
110 add_prefix_cmd ("test-settings", no_class,
111 maintenance_test_settings_cmd,
113 Generic command for testing the settings infrastructure."),
114 &maintenance_test_settings_list,
115 "maintenance test-settings ", 0,
118 add_prefix_cmd ("set", class_maintenance,
119 maintenance_test_settings_set_cmd, _("\
120 Set GDB internal variables used for set/show command infrastructure testing."),
121 &maintenance_test_settings_set_list,
122 "maintenance test-settings set ",
124 &maintenance_test_settings_list);
126 add_prefix_cmd ("show", class_maintenance,
127 maintenance_test_settings_show_cmd, _("\
128 Show GDB internal variables used for set/show command infrastructure testing."),
129 &maintenance_test_settings_show_list,
130 "maintenance test-settings show ",
132 &maintenance_test_settings_list);
134 add_setshow_boolean_cmd ("boolean", class_maintenance,
135 &maintenance_test_settings_boolean, _("\
136 command used for internal testing"), _("\
137 command used for internal testing"),
138 nullptr, /* help_doc */
139 nullptr, /* set_cmd */
140 maintenance_test_settings_show_value_cmd,
141 &maintenance_test_settings_set_list,
142 &maintenance_test_settings_show_list);
144 add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance,
145 &maintenance_test_settings_auto_boolean, _("\
146 command used for internal testing"), _("\
147 command used for internal testing"),
148 nullptr, /* help_doc */
149 nullptr, /* set_cmd */
150 maintenance_test_settings_show_value_cmd,
151 &maintenance_test_settings_set_list,
152 &maintenance_test_settings_show_list);
154 add_setshow_uinteger_cmd ("uinteger", class_maintenance,
155 &maintenance_test_settings_uinteger, _("\
156 command used for internal testing"), _("\
157 command used for internal testing"),
158 nullptr, /* help_doc */
159 nullptr, /* set_cmd */
160 maintenance_test_settings_show_value_cmd,
161 &maintenance_test_settings_set_list,
162 &maintenance_test_settings_show_list);
164 add_setshow_integer_cmd ("integer", class_maintenance,
165 &maintenance_test_settings_integer, _("\
166 command used for internal testing"), _("\
167 command used for internal testing"),
168 nullptr, /* help_doc */
169 nullptr, /* set_cmd */
170 maintenance_test_settings_show_value_cmd,
171 &maintenance_test_settings_set_list,
172 &maintenance_test_settings_show_list);
174 add_setshow_string_cmd ("string", class_maintenance,
175 &maintenance_test_settings_string, _("\
176 command used for internal testing"), _("\
177 command used for internal testing"),
178 nullptr, /* help_doc */
179 nullptr, /* set_cmd */
180 maintenance_test_settings_show_value_cmd,
181 &maintenance_test_settings_set_list,
182 &maintenance_test_settings_show_list);
184 add_setshow_string_noescape_cmd
185 ("string-noescape", class_maintenance,
186 &maintenance_test_settings_string_noescape, _("\
187 command used for internal testing"), _("\
188 command used for internal testing"),
189 nullptr, /* help_doc */
190 nullptr, /* set_cmd */
191 maintenance_test_settings_show_value_cmd,
192 &maintenance_test_settings_set_list,
193 &maintenance_test_settings_show_list);
195 add_setshow_optional_filename_cmd
196 ("optional-filename", class_maintenance,
197 &maintenance_test_settings_optional_filename, _("\
198 command used for internal testing"), _("\
199 command used for internal testing"),
200 nullptr, /* help_doc */
201 nullptr, /* set_cmd */
202 maintenance_test_settings_show_value_cmd,
203 &maintenance_test_settings_set_list,
204 &maintenance_test_settings_show_list);
206 add_setshow_filename_cmd ("filename", class_maintenance,
207 &maintenance_test_settings_filename, _("\
208 command used for internal testing"), _("\
209 command used for internal testing"),
210 nullptr, /* help_doc */
211 nullptr, /* set_cmd */
212 maintenance_test_settings_show_value_cmd,
213 &maintenance_test_settings_set_list,
214 &maintenance_test_settings_show_list);
216 add_setshow_zinteger_cmd ("zinteger", class_maintenance,
217 &maintenance_test_settings_zinteger, _("\
218 command used for internal testing"), _("\
219 command used for internal testing"),
220 nullptr, /* help_doc */
221 nullptr, /* set_cmd */
222 maintenance_test_settings_show_value_cmd,
223 &maintenance_test_settings_set_list,
224 &maintenance_test_settings_show_list);
226 add_setshow_zuinteger_cmd ("zuinteger", class_maintenance,
227 &maintenance_test_settings_zuinteger, _("\
228 command used for internal testing"), _("\
229 command used for internal testing"),
230 nullptr, /* help_doc */
231 nullptr, /* set_cmd */
232 maintenance_test_settings_show_value_cmd,
233 &maintenance_test_settings_set_list,
234 &maintenance_test_settings_show_list);
236 add_setshow_zuinteger_unlimited_cmd
237 ("zuinteger-unlimited", class_maintenance,
238 &maintenance_test_settings_zuinteger_unlimited, _("\
239 command used for internal testing"), _("\
240 command used for internal testing"),
241 nullptr, /* help_doc */
242 nullptr, /* set_cmd */
243 maintenance_test_settings_show_value_cmd,
244 &maintenance_test_settings_set_list,
245 &maintenance_test_settings_show_list);
247 add_setshow_enum_cmd ("enum", class_maintenance,
248 maintenance_test_settings_enums,
249 &maintenance_test_settings_enum, _("\
250 command used for internal testing"), _("\
251 command used for internal testing"),
252 nullptr, /* help_doc */
253 nullptr, /* set_cmd */
254 maintenance_test_settings_show_value_cmd,
255 &maintenance_test_settings_set_list,
256 &maintenance_test_settings_show_list);