summaryrefslogtreecommitdiff
path: root/gdb/maint-test-settings.c
blob: d8a6e9bb84a2d839d096df4912c48f9e4b4a58a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
/* Maintenance commands for testing the settings framework.

   Copyright (C) 2019-2020 Free Software Foundation, Inc.

   This file is part of GDB.

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */


#include "defs.h"
#include "gdbcmd.h"

/* Command list for "maint set test-settings".  */
static cmd_list_element *maintenance_set_test_settings_list;

/* Command list for "maint show test-settings".  */
static cmd_list_element *maintenance_show_test_settings_list;

/* The "maintenance set test-settings" prefix command.  */

static void
maintenance_set_test_settings_cmd (const char *args, int from_tty)
{
  printf_unfiltered (_("\"maintenance set test-settings\" must be followed "
		       "by the name of a set command.\n"));
  help_list (maintenance_set_test_settings_list,
	     "maintenance set test-settings ",
	     all_commands, gdb_stdout);
}

/* The "maintenance show test-settings" prefix command.  */

static void
maintenance_show_test_settings_cmd (const char *args, int from_tty)
{
  cmd_show_list (maintenance_show_test_settings_list, from_tty, "");
}

/* Control variables for all the "maintenance set/show test-settings
   xxx" commands.  */

static bool maintenance_test_settings_boolean;

static auto_boolean maintenance_test_settings_auto_boolean = AUTO_BOOLEAN_AUTO;

static unsigned int maintenance_test_settings_uinteger;

static int maintenance_test_settings_integer;

static int maintenance_test_settings_zinteger;

static unsigned int maintenance_test_settings_zuinteger;

static int maintenance_test_settings_zuinteger_unlimited;

static char *maintenance_test_settings_string;

static char *maintenance_test_settings_string_noescape;

static char *maintenance_test_settings_optional_filename;

static char *maintenance_test_settings_filename;

/* Enum values for the "maintenance set/show test-settings boolean"
   commands.  */
static const char maintenance_test_settings_xxx[] = "xxx";
static const char maintenance_test_settings_yyy[] = "yyy";
static const char maintenance_test_settings_zzz[] = "zzz";

static const char *const maintenance_test_settings_enums[] = {
  maintenance_test_settings_xxx,
  maintenance_test_settings_yyy,
  maintenance_test_settings_zzz,
  nullptr
};

static const char *maintenance_test_settings_enum
  = maintenance_test_settings_xxx;

/* The "maintenance show test-settings xxx" commands.  */

static void
maintenance_show_test_settings_value_cmd
  (struct ui_file *file, int from_tty,
   struct cmd_list_element *c, const char *value)
{
  fprintf_filtered (file, (("%s\n")), value);
}


void
_initialize_maint_test_settings (void)
{
  maintenance_test_settings_filename = xstrdup ("/foo/bar");

  add_prefix_cmd ("test-settings", class_maintenance,
		  maintenance_set_test_settings_cmd, _("\
Set GDB internal variables used for set/show command infrastructure testing."),
		  &maintenance_set_test_settings_list,
		  "maintenance set test-settings ",
		  0/*allow-unknown*/,
		  &maintenance_set_cmdlist);

  add_prefix_cmd ("test-settings", class_maintenance,
		  maintenance_show_test_settings_cmd, _("\
Show GDB internal variables used for set/show command infrastructure testing."),
		  &maintenance_show_test_settings_list,
		  "maintenance show test-settings ",
		  0/*allow-unknown*/,
		  &maintenance_show_cmdlist);

  add_setshow_boolean_cmd ("boolean", class_maintenance,
			   &maintenance_test_settings_boolean, _("\
command used for internal testing."), _("\
command used for internal testing."),
			   nullptr, /* help_doc */
			   nullptr, /* set_cmd */
			   maintenance_show_test_settings_value_cmd,
			   &maintenance_set_test_settings_list,
			   &maintenance_show_test_settings_list);

  add_setshow_auto_boolean_cmd ("auto-boolean", class_maintenance,
				&maintenance_test_settings_auto_boolean, _("\
command used for internal testing."), _("\
command used for internal testing."),
				nullptr, /* help_doc */
				nullptr, /* set_cmd */
				maintenance_show_test_settings_value_cmd,
				&maintenance_set_test_settings_list,
				&maintenance_show_test_settings_list);

  add_setshow_uinteger_cmd ("uinteger", class_maintenance,
			   &maintenance_test_settings_uinteger, _("\
command used for internal testing."), _("\
command used for internal testing."),
			    nullptr, /* help_doc */
			    nullptr, /* set_cmd */
			    maintenance_show_test_settings_value_cmd,
			    &maintenance_set_test_settings_list,
			    &maintenance_show_test_settings_list);

  add_setshow_integer_cmd ("integer", class_maintenance,
			   &maintenance_test_settings_integer, _("\
command used for internal testing."), _("\
command used for internal testing."),
			   nullptr, /* help_doc */
			   nullptr, /* set_cmd */
			   maintenance_show_test_settings_value_cmd,
			   &maintenance_set_test_settings_list,
			   &maintenance_show_test_settings_list);

  add_setshow_string_cmd ("string", class_maintenance,
     &maintenance_test_settings_string, _("\
command used for internal testing."), _("\
command used for internal testing."),
     nullptr, /* help_doc */
     nullptr, /* set_cmd */
			  maintenance_show_test_settings_value_cmd,
			  &maintenance_set_test_settings_list,
			  &maintenance_show_test_settings_list);

  add_setshow_string_noescape_cmd
    ("string-noescape", class_maintenance,
     &maintenance_test_settings_string_noescape, _("\
command used for internal testing."), _("\
command used for internal testing."),
     nullptr, /* help_doc */
     nullptr, /* set_cmd */
     maintenance_show_test_settings_value_cmd,
     &maintenance_set_test_settings_list,
     &maintenance_show_test_settings_list);

  add_setshow_optional_filename_cmd
    ("optional-filename", class_maintenance,
     &maintenance_test_settings_optional_filename, _("\
command used for internal testing."), _("\
command used for internal testing."),
     nullptr, /* help_doc */
     nullptr, /* set_cmd */
     maintenance_show_test_settings_value_cmd,
     &maintenance_set_test_settings_list,
     &maintenance_show_test_settings_list);

  add_setshow_filename_cmd ("filename", class_maintenance,
			    &maintenance_test_settings_filename, _("\
command used for internal testing."), _("\
command used for internal testing."),
			    nullptr, /* help_doc */
			    nullptr, /* set_cmd */
			    maintenance_show_test_settings_value_cmd,
			    &maintenance_set_test_settings_list,
			    &maintenance_show_test_settings_list);

  add_setshow_zinteger_cmd ("zinteger", class_maintenance,
			    &maintenance_test_settings_zinteger, _("\
command used for internal testing."), _("\
command used for internal testing."),
			    nullptr, /* help_doc */
			    nullptr, /* set_cmd */
			    maintenance_show_test_settings_value_cmd,
			    &maintenance_set_test_settings_list,
			    &maintenance_show_test_settings_list);

  add_setshow_zuinteger_cmd ("zuinteger", class_maintenance,
			     &maintenance_test_settings_zuinteger, _("\
command used for internal testing."), _("\
command used for internal testing."),
			     nullptr, /* help_doc */
			     nullptr, /* set_cmd */
			     maintenance_show_test_settings_value_cmd,
			     &maintenance_set_test_settings_list,
			     &maintenance_show_test_settings_list);

  add_setshow_zuinteger_unlimited_cmd
    ("zuinteger-unlimited", class_maintenance,
     &maintenance_test_settings_zuinteger_unlimited, _("\
command used for internal testing."), _("\
command used for internal testing."),
     nullptr, /* help_doc */
     nullptr, /* set_cmd */
     maintenance_show_test_settings_value_cmd,
     &maintenance_set_test_settings_list,
     &maintenance_show_test_settings_list);

  add_setshow_enum_cmd ("enum", class_maintenance,
			maintenance_test_settings_enums,
			&maintenance_test_settings_enum, _("\
command used for internal testing."), _("\
command used for internal testing."),
			nullptr, /* help_doc */
			nullptr, /* set_cmd */
			maintenance_show_test_settings_value_cmd,
			&maintenance_set_test_settings_list,
			&maintenance_show_test_settings_list);
}