Introduce refresh_window method
[external/binutils.git] / gdb / maint-test-settings.c
1 /* Support for GDB maintenance commands.
2
3    Copyright (C) 2019 Free Software Foundation, Inc.
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
24 /* Command list for "maint test-settings".  */
25 static cmd_list_element *maintenance_test_settings_list;
26
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;
30
31 /* The "maintenance test-options" prefix command.  */
32
33 static void
34 maintenance_test_settings_cmd (const char *arg, int from_tty)
35 {
36   printf_unfiltered
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);
41 }
42
43 /* The "maintenance test-options set" prefix command.  */
44
45 static void
46 maintenance_test_settings_set_cmd (const char *args, int from_tty)
47 {
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);
53 }
54
55 /* The "maintenance test-options show" prefix command.  */
56
57 static void
58 maintenance_test_settings_show_cmd (const char *args, int from_tty)
59 {
60   cmd_show_list (maintenance_test_settings_show_list, from_tty, "");
61 }
62
63 /* Control variables for all the "maintenance test-options set/show
64    xxx" commands.  */
65
66 static int maintenance_test_settings_boolean;
67
68 static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO;
69
70 static unsigned int maintenance_test_settings_uinteger;
71
72 static int maintenance_test_settings_integer;
73
74 static int maintenance_test_settings_zinteger;
75
76 static unsigned int maintenance_test_settings_zuinteger;
77
78 static int maintenance_test_settings_zuinteger_unlimited;
79
80 static char *maintenance_test_settings_string;
81
82 static char *maintenance_test_settings_string_noescape;
83
84 static char *maintenance_test_settings_optional_filename;
85
86 static char *maintenance_test_settings_filename;
87
88 static const char *maintenance_test_settings_enum;
89
90 /* Enum values for the "maintenance test-settings set/show boolean"
91    commands.  */
92 static const char *const maintenance_test_settings_enums[] = {
93   "xxx", "yyy", "zzz", nullptr
94 };
95
96 /* The "maintenance test-options show xxx" commands.  */
97
98 static void
99 maintenance_test_settings_show_value_cmd
100   (struct ui_file *file, int from_tty,
101    struct cmd_list_element *c, const char *value)
102 {
103   fprintf_filtered (file, (("%s\n")), value);
104 }
105
106 \f
107 void
108 _initialize_maint_test_settings (void)
109 {
110   add_prefix_cmd ("test-settings", no_class,
111                   maintenance_test_settings_cmd,
112                   _("\
113 Generic command for testing the settings infrastructure."),
114                   &maintenance_test_settings_list,
115                   "maintenance test-settings ", 0,
116                   &maintenancelist);
117
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 ",
123                   0/*allow-unknown*/,
124                   &maintenance_test_settings_list);
125
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 ",
131                   0/*allow-unknown*/,
132                   &maintenance_test_settings_list);
133
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);
143
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);
153
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);
163
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);
173
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);
183
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);
194
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);
205
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);
215
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);
225
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);
235
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);
246
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);
257 }