Fix library segment-address for 64bit values
[deliverable/binutils-gdb.git] / gdb / maint-test-settings.c
1 /* Maintenance commands for testing the settings framework.
2
3 Copyright (C) 2019-2020 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 set test-settings". */
25 static cmd_list_element *maintenance_set_test_settings_list;
26
27 /* Command list for "maint show test-settings". */
28 static cmd_list_element *maintenance_show_test_settings_list;
29
30 /* The "maintenance set test-settings" prefix command. */
31
32 static void
33 maintenance_set_test_settings_cmd (const char *args, int from_tty)
34 {
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);
40 }
41
42 /* The "maintenance show test-settings" prefix command. */
43
44 static void
45 maintenance_show_test_settings_cmd (const char *args, int from_tty)
46 {
47 cmd_show_list (maintenance_show_test_settings_list, from_tty, "");
48 }
49
50 /* Control variables for all the "maintenance set/show test-settings
51 xxx" commands. */
52
53 static bool maintenance_test_settings_boolean;
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
75 /* Enum values for the "maintenance set/show test-settings boolean"
76 commands. */
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
81 static const char *const maintenance_test_settings_enums[] = {
82 maintenance_test_settings_xxx,
83 maintenance_test_settings_yyy,
84 maintenance_test_settings_zzz,
85 nullptr
86 };
87
88 static const char *maintenance_test_settings_enum
89 = maintenance_test_settings_xxx;
90
91 /* The "maintenance show test-settings xxx" commands. */
92
93 static void
94 maintenance_show_test_settings_value_cmd
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
102 void
103 _initialize_maint_test_settings (void)
104 {
105 maintenance_test_settings_filename = xstrdup ("/foo/bar");
106
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 ",
112 0/*allow-unknown*/,
113 &maintenance_set_cmdlist);
114
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 ",
120 0/*allow-unknown*/,
121 &maintenance_show_cmdlist);
122
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);
132
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);
142
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);
152
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);
162
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);
172
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);
183
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);
194
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);
204
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);
214
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);
224
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);
235
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);
246 }
This page took 0.03454 seconds and 4 git commands to generate.