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 | /* Control variables for all the "maintenance set/show test-settings |
dca0f6c0 PA |
31 | xxx" commands. */ |
32 | ||
491144b5 | 33 | static bool maintenance_test_settings_boolean; |
dca0f6c0 PA |
34 | |
35 | static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO; | |
36 | ||
37 | static unsigned int maintenance_test_settings_uinteger; | |
38 | ||
39 | static int maintenance_test_settings_integer; | |
40 | ||
41 | static int maintenance_test_settings_zinteger; | |
42 | ||
43 | static unsigned int maintenance_test_settings_zuinteger; | |
44 | ||
45 | static int maintenance_test_settings_zuinteger_unlimited; | |
46 | ||
47 | static char *maintenance_test_settings_string; | |
48 | ||
49 | static char *maintenance_test_settings_string_noescape; | |
50 | ||
51 | static char *maintenance_test_settings_optional_filename; | |
52 | ||
53 | static char *maintenance_test_settings_filename; | |
54 | ||
c6ac8931 | 55 | /* Enum values for the "maintenance set/show test-settings boolean" |
dca0f6c0 | 56 | commands. */ |
970f9d09 PA |
57 | static const char maintenance_test_settings_xxx[] = "xxx"; |
58 | static const char maintenance_test_settings_yyy[] = "yyy"; | |
59 | static const char maintenance_test_settings_zzz[] = "zzz"; | |
60 | ||
dca0f6c0 | 61 | static const char *const maintenance_test_settings_enums[] = { |
970f9d09 PA |
62 | maintenance_test_settings_xxx, |
63 | maintenance_test_settings_yyy, | |
64 | maintenance_test_settings_zzz, | |
65 | nullptr | |
dca0f6c0 PA |
66 | }; |
67 | ||
970f9d09 PA |
68 | static const char *maintenance_test_settings_enum |
69 | = maintenance_test_settings_xxx; | |
70 | ||
c6ac8931 | 71 | /* The "maintenance show test-settings xxx" commands. */ |
dca0f6c0 PA |
72 | |
73 | static void | |
c6ac8931 | 74 | maintenance_show_test_settings_value_cmd |
dca0f6c0 PA |
75 | (struct ui_file *file, int from_tty, |
76 | struct cmd_list_element *c, const char *value) | |
77 | { | |
78 | fprintf_filtered (file, (("%s\n")), value); | |
79 | } | |
80 | ||
81 | \f | |
6c265988 | 82 | void _initialize_maint_test_settings (); |
dca0f6c0 | 83 | void |
6c265988 | 84 | _initialize_maint_test_settings () |
dca0f6c0 | 85 | { |
970f9d09 PA |
86 | maintenance_test_settings_filename = xstrdup ("/foo/bar"); |
87 | ||
0743fc83 TT |
88 | add_basic_prefix_cmd ("test-settings", class_maintenance, |
89 | _("\ | |
dca0f6c0 | 90 | Set GDB internal variables used for set/show command infrastructure testing."), |
0743fc83 TT |
91 | &maintenance_set_test_settings_list, |
92 | "maintenance set test-settings ", | |
93 | 0/*allow-unknown*/, | |
94 | &maintenance_set_cmdlist); | |
dca0f6c0 | 95 | |
0743fc83 TT |
96 | add_show_prefix_cmd ("test-settings", class_maintenance, |
97 | _("\ | |
dca0f6c0 | 98 | Show GDB internal variables used for set/show command infrastructure testing."), |
0743fc83 TT |
99 | &maintenance_show_test_settings_list, |
100 | "maintenance show test-settings ", | |
101 | 0/*allow-unknown*/, | |
102 | &maintenance_show_cmdlist); | |
dca0f6c0 PA |
103 | |
104 | add_setshow_boolean_cmd ("boolean", class_maintenance, | |
105 | &maintenance_test_settings_boolean, _("\ | |
590042fc PW |
106 | command used for internal testing."), _("\ |
107 | command used for internal testing."), | |
dca0f6c0 PA |
108 | nullptr, /* help_doc */ |
109 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
110 | maintenance_show_test_settings_value_cmd, |
111 | &maintenance_set_test_settings_list, | |
112 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
113 | |
114 | add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance, | |
115 | &maintenance_test_settings_auto_boolean, _("\ | |
590042fc PW |
116 | command used for internal testing."), _("\ |
117 | command used for internal testing."), | |
dca0f6c0 PA |
118 | nullptr, /* help_doc */ |
119 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
120 | maintenance_show_test_settings_value_cmd, |
121 | &maintenance_set_test_settings_list, | |
122 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
123 | |
124 | add_setshow_uinteger_cmd ("uinteger", class_maintenance, | |
125 | &maintenance_test_settings_uinteger, _("\ | |
590042fc PW |
126 | command used for internal testing."), _("\ |
127 | command used for internal testing."), | |
c6ac8931 PA |
128 | nullptr, /* help_doc */ |
129 | nullptr, /* set_cmd */ | |
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_integer_cmd ("integer", class_maintenance, | |
135 | &maintenance_test_settings_integer, _("\ | |
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_string_cmd ("string", class_maintenance, | |
145 | &maintenance_test_settings_string, _("\ | |
590042fc PW |
146 | command used for internal testing."), _("\ |
147 | command used for internal testing."), | |
dca0f6c0 PA |
148 | nullptr, /* help_doc */ |
149 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
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_string_noescape_cmd | |
155 | ("string-noescape", class_maintenance, | |
156 | &maintenance_test_settings_string_noescape, _("\ | |
590042fc PW |
157 | command used for internal testing."), _("\ |
158 | command used for internal testing."), | |
dca0f6c0 PA |
159 | nullptr, /* help_doc */ |
160 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
161 | maintenance_show_test_settings_value_cmd, |
162 | &maintenance_set_test_settings_list, | |
163 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
164 | |
165 | add_setshow_optional_filename_cmd | |
166 | ("optional-filename", class_maintenance, | |
167 | &maintenance_test_settings_optional_filename, _("\ | |
590042fc PW |
168 | command used for internal testing."), _("\ |
169 | command used for internal testing."), | |
dca0f6c0 PA |
170 | nullptr, /* help_doc */ |
171 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
172 | maintenance_show_test_settings_value_cmd, |
173 | &maintenance_set_test_settings_list, | |
174 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
175 | |
176 | add_setshow_filename_cmd ("filename", class_maintenance, | |
177 | &maintenance_test_settings_filename, _("\ | |
590042fc PW |
178 | command used for internal testing."), _("\ |
179 | command used for internal testing."), | |
dca0f6c0 PA |
180 | nullptr, /* help_doc */ |
181 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
182 | maintenance_show_test_settings_value_cmd, |
183 | &maintenance_set_test_settings_list, | |
184 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
185 | |
186 | add_setshow_zinteger_cmd ("zinteger", class_maintenance, | |
187 | &maintenance_test_settings_zinteger, _("\ | |
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_zuinteger_cmd ("zuinteger", class_maintenance, | |
197 | &maintenance_test_settings_zuinteger, _("\ | |
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_zuinteger_unlimited_cmd | |
207 | ("zuinteger-unlimited", class_maintenance, | |
208 | &maintenance_test_settings_zuinteger_unlimited, _("\ | |
590042fc PW |
209 | command used for internal testing."), _("\ |
210 | command used for internal testing."), | |
dca0f6c0 PA |
211 | nullptr, /* help_doc */ |
212 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
213 | maintenance_show_test_settings_value_cmd, |
214 | &maintenance_set_test_settings_list, | |
215 | &maintenance_show_test_settings_list); | |
dca0f6c0 PA |
216 | |
217 | add_setshow_enum_cmd ("enum", class_maintenance, | |
218 | maintenance_test_settings_enums, | |
219 | &maintenance_test_settings_enum, _("\ | |
590042fc PW |
220 | command used for internal testing."), _("\ |
221 | command used for internal testing."), | |
dca0f6c0 PA |
222 | nullptr, /* help_doc */ |
223 | nullptr, /* set_cmd */ | |
c6ac8931 PA |
224 | maintenance_show_test_settings_value_cmd, |
225 | &maintenance_set_test_settings_list, | |
226 | &maintenance_show_test_settings_list); | |
dca0f6c0 | 227 | } |