* cli/cli-decode.c (add_setshow_zuinteger_cmd): New.
* cli/cli-setshow.c (do_setshow_command): Handle it.
* command.h (enum var_types): Add var_zuinteger.
(add_setshow_zuinteger_cmd): Declare.
* valprint.c (_initialize_valprint): Change the set input-radix
and set output-radix commands to zuinteger type.
2009-01-23 Pedro Alves <pedro@codesourcery.com>
* gdb.base/radix.exp: Add tests to ensure that that set
input-radix 0 and set output-radix 0 are really rejected.
+2009-01-23 Pedro Alves <pedro@codesourcery.com>
+
+ * cli/cli-decode.c (add_setshow_zuinteger_cmd): New.
+ * cli/cli-setshow.c (do_setshow_command): Handle it.
+ * command.h (enum var_types): Add var_zuinteger.
+ (add_setshow_zuinteger_cmd): Declare.
+
+ * valprint.c (_initialize_valprint): Change the set input-radix
+ and set output-radix commands to zuinteger type.
+
2009-01-23 Pedro Alves <pedro@codesourcery.com>
PR gdb/9664:
NULL, NULL);
}
+/* Add element named NAME to both the set and show command LISTs (the
+ list for set/show or some sublist thereof). CLASS is as in
+ add_cmd. VAR is address of the variable which will contain the
+ value. SET_DOC and SHOW_DOC are the documentation strings. */
+void
+add_setshow_zuinteger_cmd (char *name, enum command_class class,
+ unsigned int *var,
+ const char *set_doc, const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list)
+{
+ add_setshow_cmd_full (name, class, var_zuinteger, var,
+ set_doc, show_doc, help_doc,
+ set_func, show_func,
+ set_list, show_list,
+ NULL, NULL);
+}
+
/* Remove the command named NAME from the command list. Return the
list commands which were aliased to the deleted command. If the
command had no aliases, return NULL. The various *HOOKs are set to
error_no_arg (_("integer to set it to."));
*(int *) c->var = parse_and_eval_long (arg);
break;
+ case var_zuinteger:
+ if (arg == NULL)
+ error_no_arg (_("integer to set it to."));
+ *(unsigned int *) c->var = parse_and_eval_long (arg);
+ break;
case var_enum:
{
int i;
break;
}
/* else fall through */
+ case var_zuinteger:
case var_zinteger:
fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
break;
/* ZeroableInteger. *VAR is an int. Like Unsigned Integer except
that zero really means zero. */
var_zinteger,
+ /* ZeroableUnsignedInteger. *VAR is an unsigned int. Zero really
+ means zero. */
+ var_zuinteger,
/* Enumerated type. Can only have one of the specified values. *VAR is a
char pointer to the name of the element that we find. */
var_enum
struct cmd_list_element **set_list,
struct cmd_list_element **show_list);
+extern void add_setshow_zuinteger_cmd (char *name,
+ enum command_class class,
+ unsigned int *var,
+ const char *set_doc,
+ const char *show_doc,
+ const char *help_doc,
+ cmd_sfunc_ftype *set_func,
+ show_value_ftype *show_func,
+ struct cmd_list_element **set_list,
+ struct cmd_list_element **show_list);
+
/* Do a "show" command for each thing on a command list. */
extern void cmd_show_list (struct cmd_list_element *, int, char *);
+2009-01-23 Pedro Alves <pedro@codesourcery.com>
+
+ * gdb.base/radix.exp: Add tests to ensure that that set
+ input-radix 0 and set output-radix 0 are really rejected.
+
2009-01-23 Pedro Alves <pedro@codesourcery.com>
* gdb.base/hook-stop-frame.c, gdb.base/hook-stop-frame.exp: Update
"Input and output radices now set to decimal 10, hex a, octal 12\." \
"Reset radices"
+gdb_test "set input-radix 0" \
+ "Nonsense input radix ``decimal 0''; input radix unchanged\\." \
+ "Reject input-radix 0"
+gdb_test "show input-radix" \
+ "Default input radix for entering numbers is 10\\." \
+ "Input radix unchanged after rejecting 0"
+
gdb_test "set input-radix 1" \
"Nonsense input radix ``decimal 1''; input radix unchanged\\." \
"Reject input-radix 1"
gdb_test "show input-radix" \
"Default input radix for entering numbers is 10\\." \
- "Input radix unchanged after rejection"
+ "Input radix unchanged after rejecting 1"
+gdb_test "set output-radix 0" \
+ "Unsupported output radix ``decimal 0''; output radix unchanged\\." \
+ "Reject output-radix 0"
+gdb_test "show output-radix" \
+ "Default output radix for printing of values is 10\\." \
+ "Output radix unchanged after rejecting 0"
gdb_test "set output-radix 1" \
"Unsupported output radix ``decimal 1''; output radix unchanged\\." \
"Reject output-radix 1"
gdb_test "show output-radix" \
"Default output radix for printing of values is 10\\." \
- "Output radix unchanged after rejection"
+ "Output radix unchanged after rejecting 1"
gdb_test "set radix 7" \
"Unsupported output radix ``decimal 7''; output radix unchanged\\." \
show_addressprint,
&setprintlist, &showprintlist);
- add_setshow_uinteger_cmd ("input-radix", class_support, &input_radix_1,
- _("\
+ add_setshow_zuinteger_cmd ("input-radix", class_support, &input_radix_1,
+ _("\
Set default input radix for entering numbers."), _("\
Show default input radix for entering numbers."), NULL,
- set_input_radix,
- show_input_radix,
- &setlist, &showlist);
+ set_input_radix,
+ show_input_radix,
+ &setlist, &showlist);
- add_setshow_uinteger_cmd ("output-radix", class_support, &output_radix_1,
- _("\
+ add_setshow_zuinteger_cmd ("output-radix", class_support, &output_radix_1,
+ _("\
Set default output radix for printing of values."), _("\
Show default output radix for printing of values."), NULL,
- set_output_radix,
- show_output_radix,
- &setlist, &showlist);
+ set_output_radix,
+ show_output_radix,
+ &setlist, &showlist);
/* The "set radix" and "show radix" commands are special in that
they are like normal set and show commands but allow two normally