1 /* Maintenance commands for testing the settings framework.
3 Copyright (C) 2019-2024 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 /* Control variables for all the "maintenance set/show test-settings
33 static bool maintenance_test_settings_boolean
;
35 static auto_boolean maintenance_test_settings_auto_boolean
= AUTO_BOOLEAN_AUTO
;
37 static unsigned int maintenance_test_settings_uinteger
;
39 static int maintenance_test_settings_integer
;
41 static int maintenance_test_settings_zinteger
;
43 static unsigned int maintenance_test_settings_zuinteger
;
45 static int maintenance_test_settings_zuinteger_unlimited
;
47 static std::string maintenance_test_settings_string
;
49 static std::string maintenance_test_settings_string_noescape
;
51 static std::string maintenance_test_settings_optional_filename
;
53 static std::string maintenance_test_settings_filename
;
55 /* Enum values for the "maintenance set/show test-settings boolean"
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";
61 static const char *const maintenance_test_settings_enums
[] = {
62 maintenance_test_settings_xxx
,
63 maintenance_test_settings_yyy
,
64 maintenance_test_settings_zzz
,
68 static const char *maintenance_test_settings_enum
69 = maintenance_test_settings_xxx
;
71 /* The "maintenance show test-settings xxx" commands. */
74 maintenance_show_test_settings_value_cmd
75 (struct ui_file
*file
, int from_tty
,
76 struct cmd_list_element
*c
, const char *value
)
78 gdb_printf (file
, (("%s\n")), value
);
82 void _initialize_maint_test_settings ();
84 _initialize_maint_test_settings ()
86 maintenance_test_settings_filename
= "/foo/bar";
88 add_setshow_prefix_cmd ("test-settings", class_maintenance
,
90 Set GDB internal variables used for set/show command infrastructure testing."),
92 Show GDB internal variables used for set/show command infrastructure testing."),
93 &maintenance_set_test_settings_list
,
94 &maintenance_show_test_settings_list
,
95 &maintenance_set_cmdlist
, &maintenance_show_cmdlist
);
97 add_setshow_boolean_cmd ("boolean", class_maintenance
,
98 &maintenance_test_settings_boolean
, _("\
99 command used for internal testing."), _("\
100 command used for internal testing."),
101 nullptr, /* help_doc */
102 nullptr, /* set_cmd */
103 maintenance_show_test_settings_value_cmd
,
104 &maintenance_set_test_settings_list
,
105 &maintenance_show_test_settings_list
);
107 add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance
,
108 &maintenance_test_settings_auto_boolean
, _("\
109 command used for internal testing."), _("\
110 command used for internal testing."),
111 nullptr, /* help_doc */
112 nullptr, /* set_cmd */
113 maintenance_show_test_settings_value_cmd
,
114 &maintenance_set_test_settings_list
,
115 &maintenance_show_test_settings_list
);
117 add_setshow_uinteger_cmd ("uinteger", class_maintenance
,
118 &maintenance_test_settings_uinteger
, _("\
119 command used for internal testing."), _("\
120 command used for internal testing."),
121 nullptr, /* help_doc */
122 nullptr, /* set_cmd */
123 maintenance_show_test_settings_value_cmd
,
124 &maintenance_set_test_settings_list
,
125 &maintenance_show_test_settings_list
);
127 add_setshow_integer_cmd ("integer", class_maintenance
,
128 &maintenance_test_settings_integer
, _("\
129 command used for internal testing."), _("\
130 command used for internal testing."),
131 nullptr, /* help_doc */
132 nullptr, /* set_cmd */
133 maintenance_show_test_settings_value_cmd
,
134 &maintenance_set_test_settings_list
,
135 &maintenance_show_test_settings_list
);
137 add_setshow_string_cmd ("string", class_maintenance
,
138 &maintenance_test_settings_string
, _("\
139 command used for internal testing."), _("\
140 command used for internal testing."),
141 nullptr, /* help_doc */
142 nullptr, /* set_cmd */
143 maintenance_show_test_settings_value_cmd
,
144 &maintenance_set_test_settings_list
,
145 &maintenance_show_test_settings_list
);
147 add_setshow_string_noescape_cmd
148 ("string-noescape", class_maintenance
,
149 &maintenance_test_settings_string_noescape
, _("\
150 command used for internal testing."), _("\
151 command used for internal testing."),
152 nullptr, /* help_doc */
153 nullptr, /* set_cmd */
154 maintenance_show_test_settings_value_cmd
,
155 &maintenance_set_test_settings_list
,
156 &maintenance_show_test_settings_list
);
158 add_setshow_optional_filename_cmd
159 ("optional-filename", class_maintenance
,
160 &maintenance_test_settings_optional_filename
, _("\
161 command used for internal testing."), _("\
162 command used for internal testing."),
163 nullptr, /* help_doc */
164 nullptr, /* set_cmd */
165 maintenance_show_test_settings_value_cmd
,
166 &maintenance_set_test_settings_list
,
167 &maintenance_show_test_settings_list
);
169 add_setshow_filename_cmd ("filename", class_maintenance
,
170 &maintenance_test_settings_filename
, _("\
171 command used for internal testing."), _("\
172 command used for internal testing."),
173 nullptr, /* help_doc */
174 nullptr, /* set_cmd */
175 maintenance_show_test_settings_value_cmd
,
176 &maintenance_set_test_settings_list
,
177 &maintenance_show_test_settings_list
);
179 add_setshow_zinteger_cmd ("zinteger", class_maintenance
,
180 &maintenance_test_settings_zinteger
, _("\
181 command used for internal testing."), _("\
182 command used for internal testing."),
183 nullptr, /* help_doc */
184 nullptr, /* set_cmd */
185 maintenance_show_test_settings_value_cmd
,
186 &maintenance_set_test_settings_list
,
187 &maintenance_show_test_settings_list
);
189 add_setshow_zuinteger_cmd ("zuinteger", class_maintenance
,
190 &maintenance_test_settings_zuinteger
, _("\
191 command used for internal testing."), _("\
192 command used for internal testing."),
193 nullptr, /* help_doc */
194 nullptr, /* set_cmd */
195 maintenance_show_test_settings_value_cmd
,
196 &maintenance_set_test_settings_list
,
197 &maintenance_show_test_settings_list
);
199 add_setshow_zuinteger_unlimited_cmd
200 ("zuinteger-unlimited", class_maintenance
,
201 &maintenance_test_settings_zuinteger_unlimited
, _("\
202 command used for internal testing."), _("\
203 command used for internal testing."),
204 nullptr, /* help_doc */
205 nullptr, /* set_cmd */
206 maintenance_show_test_settings_value_cmd
,
207 &maintenance_set_test_settings_list
,
208 &maintenance_show_test_settings_list
);
210 add_setshow_enum_cmd ("enum", class_maintenance
,
211 maintenance_test_settings_enums
,
212 &maintenance_test_settings_enum
, _("\
213 command used for internal testing."), _("\
214 command used for internal testing."),
215 nullptr, /* help_doc */
216 nullptr, /* set_cmd */
217 maintenance_show_test_settings_value_cmd
,
218 &maintenance_set_test_settings_list
,
219 &maintenance_show_test_settings_list
);