aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog10
-rw-r--r--gdb/cli/cli-decode.c21
-rw-r--r--gdb/cli/cli-setshow.c6
-rw-r--r--gdb/command.h14
-rw-r--r--gdb/testsuite/ChangeLog5
-rw-r--r--gdb/testsuite/gdb.base/radix.exp17
-rw-r--r--gdb/valprint.c20
7 files changed, 81 insertions, 12 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d6b611e..e85963d 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,15 @@
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:
* infrun.c (normal_stop): Tag threads as stopped, and run the
hook-stop before printing the stack frame.
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index d71d516..556c027 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -639,6 +639,27 @@ add_setshow_zinteger_cmd (char *name, enum command_class class,
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
diff --git a/gdb/cli/cli-setshow.c b/gdb/cli/cli-setshow.c
index be0581d..206a55d 100644
--- a/gdb/cli/cli-setshow.c
+++ b/gdb/cli/cli-setshow.c
@@ -232,6 +232,11 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
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;
@@ -351,6 +356,7 @@ do_setshow_command (char *arg, int from_tty, struct cmd_list_element *c)
break;
}
/* else fall through */
+ case var_zuinteger:
case var_zinteger:
fprintf_filtered (stb->stream, "%u", *(unsigned int *) c->var);
break;
diff --git a/gdb/command.h b/gdb/command.h
index 1aeca6b..b3f7013 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -87,6 +87,9 @@ typedef enum var_types
/* 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
@@ -332,6 +335,17 @@ extern void add_setshow_zinteger_cmd (char *name,
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 *);
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 4939075..4e60fa0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,5 +1,10 @@
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
copyright years.
diff --git a/gdb/testsuite/gdb.base/radix.exp b/gdb/testsuite/gdb.base/radix.exp
index 172e40f..750fd23 100644
--- a/gdb/testsuite/gdb.base/radix.exp
+++ b/gdb/testsuite/gdb.base/radix.exp
@@ -162,19 +162,32 @@ gdb_test "set radix" \
"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\\." \
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 73d9a99..b61da54 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -1576,21 +1576,21 @@ Show printing of addresses."), NULL,
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