From 883b9c6c986112470844e07039d55789d11f706b Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Tue, 28 Aug 2012 14:08:42 +0000 Subject: gdb/ * cli/cli-cmds.c (max_user_call_depth): Add 'unsigned'. (init_cmds): Call add_setshow_uinteger_cmd for command 'max-user-call-depth'. * cli/cli-script.c (execute_user_command): Add 'unsigned' to the declaration of 'max_user_call_depth'. * frame.c (backtrace_limit): Add 'unsigned'. (_initialize_frame): Call add_setshow_uinteger_cmd for command 'limit'. * remote.c (remoteaddresssize): Add 'unsigned'. (remote_address_masked): Change local var 'address_size' to 'unsigned'. (_initialize_remote): Call add_setshow_uinteger_cmd for 'remoteaddresssize'. * top.c (history_size): Add 'unsigned'. (show_commands): Change local variables to 'unsigned'. (set_history_size_command): Don't check history_size is negative. Adjust the condition to call unstifle_history and set history_size to UNIT_MAX. --- gdb/top.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'gdb/top.c') diff --git a/gdb/top.c b/gdb/top.c index 7084116..99fd5ff 100644 --- a/gdb/top.c +++ b/gdb/top.c @@ -710,7 +710,7 @@ show_write_history_p (struct ui_file *file, int from_tty, value); } -static int history_size; +static unsigned int history_size; static void show_history_size (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value) @@ -1380,7 +1380,7 @@ show_commands (char *args, int from_tty) /* The first command in the history which doesn't exist (i.e. one more than the number of the last command). Relative to history_base. */ - int hist_len; + unsigned int hist_len; /* Print out some of the commands from the command history. */ /* First determine the length of the history list. */ @@ -1445,15 +1445,16 @@ show_commands (char *args, int from_tty) static void set_history_size_command (char *args, int from_tty, struct cmd_list_element *c) { - if (history_size == INT_MAX) - unstifle_history (); - else if (history_size >= 0) - stifle_history (history_size); - else + /* The type of parameter in stifle_history is int, so values from INT_MAX up + mean 'unlimited'. */ + if (history_size >= INT_MAX) { - history_size = INT_MAX; - error (_("History size must be non-negative")); + /* Ensure that 'show history size' prints 'unlimited'. */ + history_size = UINT_MAX; + unstifle_history (); } + else + stifle_history (history_size); } void @@ -1633,13 +1634,13 @@ Without an argument, saving is enabled."), show_write_history_p, &sethistlist, &showhistlist); - add_setshow_integer_cmd ("size", no_class, &history_size, _("\ + add_setshow_uinteger_cmd ("size", no_class, &history_size, _("\ Set the size of the command history,"), _("\ Show the size of the command history,"), _("\ ie. the number of previous commands to keep a record of."), - set_history_size_command, - show_history_size, - &sethistlist, &showhistlist); + set_history_size_command, + show_history_size, + &sethistlist, &showhistlist); add_setshow_filename_cmd ("filename", no_class, &history_filename, _("\ Set the filename in which to record the command history"), _("\ -- cgit v1.1