Commit | Line | Data |
---|---|---|
d1fcf2fd | 1 | /* Maintenance commands for testing the settings framework. |
dca0f6c0 | 2 | |
b811d2c2 | 3 | Copyright (C) 2019-2020 Free Software Foundation, Inc. |
dca0f6c0 PA |
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 | |
6c265988 | 102 | void _initialize_maint_test_settings (); |
dca0f6c0 | 103 | void |
6c265988 | 104 | _initialize_maint_test_settings () |
dca0f6c0 | 105 | { |
970f9d09 PA |
106 | maintenance_test_settings_filename = xstrdup ("/foo/bar"); |
107 | ||
c6ac8931 PA |
108 | add_prefix_cmd ("test-settings", class_maintenance, |
109 | maintenance_set_test_settings_cmd, _("\ | |
dca0f6c0 | 110 | Set GDB internal variables used for set/show command infrastructure testing."), |
c6ac8931 PA |
111 | &maintenance_set_test_settings_list, |
112 | "maintenance set test-settings ", | |
dca0f6c0 | 113 | 0/*allow-unknown*/, |
c6ac8931 | 114 | &maintenance_set_cmdlist); |
dca0f6c0 | 115 | |
c6ac8931 PA |
116 | add_prefix_cmd ("test-settings", class_maintenance, |
117 | maintenance_show_test_settings_cmd, _("\ | |
dca0f6c0 | 118 | Show GDB internal variables used for set/show command infrastructure testing."), |
c6ac8931 PA |
119 | &maintenance_show_test_settings_list, |
120 | "maintenance show test-settings ", | |
dca0f6c0 | 121 | 0/*allow-unknown*/, |
c6ac8931 | 122 | &maintenance_show_cmdlist); |
dca0f6c0 PA |
123 | |
124 | add_setshow_boolean_cmd ("boolean", class_maintenance, | |
125 | &maintenance_test_settings_boolean, _("\ | |
590042fc PW |
126 | command used for internal testing."), _("\ |
127 | command used for internal testing."), | |
dca0f6c0 PA |
128 | nullptr, /* help_doc */ |
129 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
130 | maintenance_show_test_settings_value_cmd, |
131 | &maintenance_set_test_settings_list, | |
132 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
133 | |
134 | add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance, | |
135 | &maintenance_test_settings_auto_boolean, _("\ | |
590042fc PW |
136 | command used for internal testing."), _("\ |
137 | command used for internal testing."), | |
dca0f6c0 PA |
138 | nullptr, /* help_doc */ |
139 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
140 | maintenance_show_test_settings_value_cmd, |
141 | &maintenance_set_test_settings_list, | |
142 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
143 | |
144 | add_setshow_uinteger_cmd ("uinteger", class_maintenance, | |
145 | &maintenance_test_settings_uinteger, _("\ | |
590042fc PW |
146 | command used for internal testing."), _("\ |
147 | command used for internal testing."), | |
c6ac8931 PA |
148 | nullptr, /* help_doc */ |
149 | nullptr, /* set_cmd */ | |
150 | maintenance_show_test_settings_value_cmd, | |
151 | &maintenance_set_test_settings_list, | |
152 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
153 | |
154 | add_setshow_integer_cmd ("integer", class_maintenance, | |
155 | &maintenance_test_settings_integer, _("\ | |
590042fc PW |
156 | command used for internal testing."), _("\ |
157 | command used for internal testing."), | |
dca0f6c0 PA |
158 | nullptr, /* help_doc */ |
159 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
160 | maintenance_show_test_settings_value_cmd, |
161 | &maintenance_set_test_settings_list, | |
162 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
163 | |
164 | add_setshow_string_cmd ("string", class_maintenance, | |
165 | &maintenance_test_settings_string, _("\ | |
590042fc PW |
166 | command used for internal testing."), _("\ |
167 | command used for internal testing."), | |
dca0f6c0 PA |
168 | nullptr, /* help_doc */ |
169 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
170 | maintenance_show_test_settings_value_cmd, |
171 | &maintenance_set_test_settings_list, | |
172 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
173 | |
174 | add_setshow_string_noescape_cmd | |
175 | ("string-noescape", class_maintenance, | |
176 | &maintenance_test_settings_string_noescape, _("\ | |
590042fc PW |
177 | command used for internal testing."), _("\ |
178 | command used for internal testing."), | |
dca0f6c0 PA |
179 | nullptr, /* help_doc */ |
180 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
181 | maintenance_show_test_settings_value_cmd, |
182 | &maintenance_set_test_settings_list, | |
183 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
184 | |
185 | add_setshow_optional_filename_cmd | |
186 | ("optional-filename", class_maintenance, | |
187 | &maintenance_test_settings_optional_filename, _("\ | |
590042fc PW |
188 | command used for internal testing."), _("\ |
189 | command used for internal testing."), | |
dca0f6c0 PA |
190 | nullptr, /* help_doc */ |
191 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
192 | maintenance_show_test_settings_value_cmd, |
193 | &maintenance_set_test_settings_list, | |
194 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
195 | |
196 | add_setshow_filename_cmd ("filename", class_maintenance, | |
197 | &maintenance_test_settings_filename, _("\ | |
590042fc PW |
198 | command used for internal testing."), _("\ |
199 | command used for internal testing."), | |
dca0f6c0 PA |
200 | nullptr, /* help_doc */ |
201 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
202 | maintenance_show_test_settings_value_cmd, |
203 | &maintenance_set_test_settings_list, | |
204 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
205 | |
206 | add_setshow_zinteger_cmd ("zinteger", class_maintenance, | |
207 | &maintenance_test_settings_zinteger, _("\ | |
590042fc PW |
208 | command used for internal testing."), _("\ |
209 | command used for internal testing."), | |
dca0f6c0 PA |
210 | nullptr, /* help_doc */ |
211 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
212 | maintenance_show_test_settings_value_cmd, |
213 | &maintenance_set_test_settings_list, | |
214 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
215 | |
216 | add_setshow_zuinteger_cmd ("zuinteger", class_maintenance, | |
217 | &maintenance_test_settings_zuinteger, _("\ | |
590042fc PW |
218 | command used for internal testing."), _("\ |
219 | command used for internal testing."), | |
dca0f6c0 PA |
220 | nullptr, /* help_doc */ |
221 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
222 | maintenance_show_test_settings_value_cmd, |
223 | &maintenance_set_test_settings_list, | |
224 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
225 | |
226 | add_setshow_zuinteger_unlimited_cmd | |
227 | ("zuinteger-unlimited", class_maintenance, | |
228 | &maintenance_test_settings_zuinteger_unlimited, _("\ | |
590042fc PW |
229 | command used for internal testing."), _("\ |
230 | command used for internal testing."), | |
dca0f6c0 PA |
231 | nullptr, /* help_doc */ |
232 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
233 | maintenance_show_test_settings_value_cmd, |
234 | &maintenance_set_test_settings_list, | |
235 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
236 | |
237 | add_setshow_enum_cmd ("enum", class_maintenance, | |
238 | maintenance_test_settings_enums, | |
239 | &maintenance_test_settings_enum, _("\ | |
590042fc PW |
240 | command used for internal testing."), _("\ |
241 | command used for internal testing."), | |
dca0f6c0 PA |
242 | nullptr, /* help_doc */ |
243 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
244 | maintenance_show_test_settings_value_cmd, |
245 | &maintenance_set_test_settings_list, | |
246 | &maintenance_show_test_settings_list); | |
dca0f6c0 | 247 | } |