1 /* Maintenance commands for testing the settings framework.
3 Copyright (C) 2019-2020 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 set test-settings". */
25 static cmd_list_element
*maintenance_set_test_settings_list
;
27 /* Command list for "maint show test-settings". */
28 static cmd_list_element
*maintenance_show_test_settings_list
;
30 /* The "maintenance set test-settings" prefix command. */
33 maintenance_set_test_settings_cmd (const char *args
, int from_tty
)
35 printf_unfiltered (_("\"maintenance set test-settings\" must be followed "
36 "by the name of a set command.\n"));
37 help_list (maintenance_set_test_settings_list
,
38 "maintenance set test-settings ",
39 all_commands
, gdb_stdout
);
42 /* The "maintenance show test-settings" prefix command. */
45 maintenance_show_test_settings_cmd (const char *args
, int from_tty
)
47 cmd_show_list (maintenance_show_test_settings_list
, from_tty
, "");
50 /* Control variables for all the "maintenance set/show test-settings
53 static bool maintenance_test_settings_boolean
;
55 static auto_boolean maintenance_test_settings_auto_boolean
= AUTO_BOOLEAN_AUTO
;
57 static unsigned int maintenance_test_settings_uinteger
;
59 static int maintenance_test_settings_integer
;
61 static int maintenance_test_settings_zinteger
;
63 static unsigned int maintenance_test_settings_zuinteger
;
65 static int maintenance_test_settings_zuinteger_unlimited
;
67 static char *maintenance_test_settings_string
;
69 static char *maintenance_test_settings_string_noescape
;
71 static char *maintenance_test_settings_optional_filename
;
73 static char *maintenance_test_settings_filename
;
75 /* Enum values for the "maintenance set/show test-settings boolean"
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";
81 static const char *const maintenance_test_settings_enums
[] = {
82 maintenance_test_settings_xxx
,
83 maintenance_test_settings_yyy
,
84 maintenance_test_settings_zzz
,
88 static const char *maintenance_test_settings_enum
89 = maintenance_test_settings_xxx
;
91 /* The "maintenance show test-settings xxx" commands. */
94 maintenance_show_test_settings_value_cmd
95 (struct ui_file
*file
, int from_tty
,
96 struct cmd_list_element
*c
, const char *value
)
98 fprintf_filtered (file
, (("%s\n")), value
);
103 _initialize_maint_test_settings (void)
105 maintenance_test_settings_filename
= xstrdup ("/foo/bar");
107 add_prefix_cmd ("test-settings", class_maintenance
,
108 maintenance_set_test_settings_cmd
, _("\
109 Set GDB internal variables used for set/show command infrastructure testing."),
110 &maintenance_set_test_settings_list
,
111 "maintenance set test-settings ",
113 &maintenance_set_cmdlist
);
115 add_prefix_cmd ("test-settings", class_maintenance
,
116 maintenance_show_test_settings_cmd
, _("\
117 Show GDB internal variables used for set/show command infrastructure testing."),
118 &maintenance_show_test_settings_list
,
119 "maintenance show test-settings ",
121 &maintenance_show_cmdlist
);
123 add_setshow_boolean_cmd ("boolean", class_maintenance
,
124 &maintenance_test_settings_boolean
, _("\
125 command used for internal testing."), _("\
126 command used for internal testing."),
127 nullptr, /* help_doc */
128 nullptr, /* set_cmd */
129 maintenance_show_test_settings_value_cmd
,
130 &maintenance_set_test_settings_list
,
131 &maintenance_show_test_settings_list
);
133 add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance
,
134 &maintenance_test_settings_auto_boolean
, _("\
135 command used for internal testing."), _("\
136 command used for internal testing."),
137 nullptr, /* help_doc */
138 nullptr, /* set_cmd */
139 maintenance_show_test_settings_value_cmd
,
140 &maintenance_set_test_settings_list
,
141 &maintenance_show_test_settings_list
);
143 add_setshow_uinteger_cmd ("uinteger", class_maintenance
,
144 &maintenance_test_settings_uinteger
, _("\
145 command used for internal testing."), _("\
146 command used for internal testing."),
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
);
153 add_setshow_integer_cmd ("integer", class_maintenance
,
154 &maintenance_test_settings_integer
, _("\
155 command used for internal testing."), _("\
156 command used for internal testing."),
157 nullptr, /* help_doc */
158 nullptr, /* set_cmd */
159 maintenance_show_test_settings_value_cmd
,
160 &maintenance_set_test_settings_list
,
161 &maintenance_show_test_settings_list
);
163 add_setshow_string_cmd ("string", class_maintenance
,
164 &maintenance_test_settings_string
, _("\
165 command used for internal testing."), _("\
166 command used for internal testing."),
167 nullptr, /* help_doc */
168 nullptr, /* set_cmd */
169 maintenance_show_test_settings_value_cmd
,
170 &maintenance_set_test_settings_list
,
171 &maintenance_show_test_settings_list
);
173 add_setshow_string_noescape_cmd
174 ("string-noescape", class_maintenance
,
175 &maintenance_test_settings_string_noescape
, _("\
176 command used for internal testing."), _("\
177 command used for internal testing."),
178 nullptr, /* help_doc */
179 nullptr, /* set_cmd */
180 maintenance_show_test_settings_value_cmd
,
181 &maintenance_set_test_settings_list
,
182 &maintenance_show_test_settings_list
);
184 add_setshow_optional_filename_cmd
185 ("optional-filename", class_maintenance
,
186 &maintenance_test_settings_optional_filename
, _("\
187 command used for internal testing."), _("\
188 command used for internal testing."),
189 nullptr, /* help_doc */
190 nullptr, /* set_cmd */
191 maintenance_show_test_settings_value_cmd
,
192 &maintenance_set_test_settings_list
,
193 &maintenance_show_test_settings_list
);
195 add_setshow_filename_cmd ("filename", class_maintenance
,
196 &maintenance_test_settings_filename
, _("\
197 command used for internal testing."), _("\
198 command used for internal testing."),
199 nullptr, /* help_doc */
200 nullptr, /* set_cmd */
201 maintenance_show_test_settings_value_cmd
,
202 &maintenance_set_test_settings_list
,
203 &maintenance_show_test_settings_list
);
205 add_setshow_zinteger_cmd ("zinteger", class_maintenance
,
206 &maintenance_test_settings_zinteger
, _("\
207 command used for internal testing."), _("\
208 command used for internal testing."),
209 nullptr, /* help_doc */
210 nullptr, /* set_cmd */
211 maintenance_show_test_settings_value_cmd
,
212 &maintenance_set_test_settings_list
,
213 &maintenance_show_test_settings_list
);
215 add_setshow_zuinteger_cmd ("zuinteger", class_maintenance
,
216 &maintenance_test_settings_zuinteger
, _("\
217 command used for internal testing."), _("\
218 command used for internal testing."),
219 nullptr, /* help_doc */
220 nullptr, /* set_cmd */
221 maintenance_show_test_settings_value_cmd
,
222 &maintenance_set_test_settings_list
,
223 &maintenance_show_test_settings_list
);
225 add_setshow_zuinteger_unlimited_cmd
226 ("zuinteger-unlimited", class_maintenance
,
227 &maintenance_test_settings_zuinteger_unlimited
, _("\
228 command used for internal testing."), _("\
229 command used for internal testing."),
230 nullptr, /* help_doc */
231 nullptr, /* set_cmd */
232 maintenance_show_test_settings_value_cmd
,
233 &maintenance_set_test_settings_list
,
234 &maintenance_show_test_settings_list
);
236 add_setshow_enum_cmd ("enum", class_maintenance
,
237 maintenance_test_settings_enums
,
238 &maintenance_test_settings_enum
, _("\
239 command used for internal testing."), _("\
240 command used for internal testing."),
241 nullptr, /* help_doc */
242 nullptr, /* set_cmd */
243 maintenance_show_test_settings_value_cmd
,
244 &maintenance_set_test_settings_list
,
245 &maintenance_show_test_settings_list
);