gdb/
authorYao Qi <yao@codesourcery.com>
Mon, 17 Sep 2012 08:42:14 +0000 (08:42 +0000)
committerYao Qi <yao@codesourcery.com>
Mon, 17 Sep 2012 08:42:14 +0000 (08:42 +0000)
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
Update comment to add_setshow_integer_cmd.
* cli/cli-setshow.c (do_set_command): Handle case
'var_zuinteger_unlimited'.
(do_show_command): Likewise.
* cli/cli-cmds.c (init_cmds): Call add_setshow_zuinteger_unlimited_cmd
for command 'remotetimeout'.
* command.h (enum var_types): New zuinteger_unlimited.  Update comment
to var_integer.
* source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd
for command 'set listsize'.

gdb/doc/
* gdb.texinfo (List): Describe the meaning of 0 and -1 in
'set listsize'.

gdb/testsuite/
* gdb.base/list.exp (set_listsize): Don't set arg to "unlimited"
when it is less than 0.

gdb/ChangeLog
gdb/cli/cli-cmds.c
gdb/cli/cli-decode.c
gdb/cli/cli-setshow.c
gdb/command.h
gdb/doc/ChangeLog
gdb/doc/gdb.texinfo
gdb/source.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/list.exp

index 1cc4babb32b89f5c25fc2ac95cb3efa05d77a85f..f73ad6586900f6113931179457aa5c0c30a54b18 100644 (file)
@@ -1,3 +1,17 @@
+2012-09-17  Yao Qi  <yao@codesourcery.com>
+
+       * cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
+       Update comment to add_setshow_integer_cmd.
+       * cli/cli-setshow.c (do_set_command): Handle case
+       'var_zuinteger_unlimited'.
+       (do_show_command): Likewise.
+       * cli/cli-cmds.c (init_cmds): Call add_setshow_zuinteger_unlimited_cmd
+       for command 'remotetimeout'.
+       * command.h (enum var_types): New zuinteger_unlimited.  Update comment
+       to var_integer.
+       * source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd
+       for command 'set listsize'.
+
 2012-09-17  Siddhesh Poyarekar  <siddhesh@redhat.com>
 
        * infrun.c (restore_infcall_suspend_state): Eliminate single-use
index d3473d519591df6adf243b13147da504a30e6687..2e988045d0f95d554b466eda3790b22418607d71 100644 (file)
@@ -1826,14 +1826,15 @@ is displayed."),
                            show_remote_debug,
                            &setdebuglist, &showdebuglist);
 
-  add_setshow_integer_cmd ("remotetimeout", no_class, &remote_timeout, _("\
+  add_setshow_zuinteger_unlimited_cmd ("remotetimeout", no_class,
+                                      &remote_timeout, _("\
 Set timeout limit to wait for target to respond."), _("\
 Show timeout limit to wait for target to respond."), _("\
 This value is used to set the time limit for gdb to wait for a response\n\
 from the target."),
-                          NULL,
-                          show_remote_timeout,
-                          &setlist, &showlist);
+                                      NULL,
+                                      show_remote_timeout,
+                                      &setlist, &showlist);
 
   add_prefix_cmd ("debug", no_class, set_debug,
                  _("Generic command for setting gdb debugging flags"),
index 4752a829ed551cae198f3174bff13278095f50a9..6e0f0dee477ee3bf6cf50a9d378a68f777200ffa 100644 (file)
@@ -632,7 +632,8 @@ add_setshow_optional_filename_cmd (char *name, enum command_class class,
 /* 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.  */
+   value.  SET_DOC and SHOW_DOC are the documentation strings.  This
+   function is only used in Python API.  Please don't use it elsewhere.  */
 void
 add_setshow_integer_cmd (char *name, enum command_class class,
                         int *var,
@@ -692,6 +693,25 @@ add_setshow_zinteger_cmd (char *name, enum command_class class,
                        NULL, NULL);
 }
 
+void
+add_setshow_zuinteger_unlimited_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_unlimited, var,
+                       set_doc, show_doc, help_doc,
+                       set_func, show_func,
+                       set_list, show_list,
+                       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
index 89e095a953eeef89509ee22a0c6be4b1b624a820..9d8cb2ea51ed0213df6e85e705eb8ab8b8cc44e7 100644 (file)
@@ -379,6 +379,26 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c)
          }
       }
       break;
+    case var_zuinteger_unlimited:
+      {
+       LONGEST val;
+
+       if (arg == NULL)
+         error_no_arg (_("integer to set it to."));
+       val = parse_and_eval_long (arg);
+
+       if (val >= INT_MAX)
+         error (_("integer %s out of range"), plongest (val));
+       else if (val < -1)
+         error (_("only -1 is allowed to set as unlimited"));
+
+       if (*(int *) c->var != val)
+         {
+           *(int *) c->var = val;
+           option_changed = 1;
+         }
+      }
+      break;
     default:
       error (_("gdb internal error: bad var_type in do_setshow_command"));
     }
@@ -478,6 +498,7 @@ do_set_command (char *arg, int from_tty, struct cmd_list_element *c)
          break;
        case var_integer:
        case var_zinteger:
+       case var_zuinteger_unlimited:
          {
            char s[64];
 
@@ -562,7 +583,14 @@ do_show_command (char *arg, int from_tty, struct cmd_list_element *c)
       else
        fprintf_filtered (stb, "%d", *(int *) c->var);
       break;
-
+    case var_zuinteger_unlimited:
+      {
+       if (*(int *) c->var == -1)
+         fputs_filtered ("unlimited", stb);
+       else
+         fprintf_filtered (stb, "%u", *(int *) c->var);
+      }
+      break;
     default:
       error (_("gdb internal error: bad var_type in do_show_command"));
     }
index 88895bb04de5c74321d0f751ffc85b9ff8d1d384..b88bd8b7e8d6dfbe049ca1bd3ae082b2f2b30593 100644 (file)
@@ -77,7 +77,8 @@ typedef enum var_types
 
     /* Like var_uinteger but signed.  *VAR is an int.  The user can
        type 0 to mean "unlimited", which is stored in *VAR as
-       INT_MAX.  */
+       INT_MAX.  The only remaining use of it is the Python API.
+       Don't use it elsewhere.  */
     var_integer,
 
     /* String which the user enters with escapes (e.g. the user types
@@ -99,6 +100,9 @@ typedef enum var_types
     /* ZeroableUnsignedInteger.  *VAR is an unsigned int.  Zero really
        means zero.  */
     var_zuinteger,
+    /* ZeroableUnsignedInteger with unlimited value.  *VAR is an unsigned
+       int, but its range is [0, INT_MAX].  -1 stands for unlimited.  */
+    var_zuinteger_unlimited,
     /* Enumerated type.  Can only have one of the specified values.
        *VAR is a char pointer to the name of the element that we
        find.  */
@@ -354,6 +358,18 @@ extern void add_setshow_zuinteger_cmd (char *name,
                                       struct cmd_list_element **set_list,
                                       struct cmd_list_element **show_list);
 
+extern void
+  add_setshow_zuinteger_unlimited_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 *);
index 17ab90012a2f9aef84381269232f9fb88b13aa9c..adcd4ff7b2ec9a15b821b627fe0376ca3770b68e 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-17  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.texinfo (List): Describe the meaning of 0 and -1 in
+       'set listsize'.
+
 2012-09-13  Jan Kratochvil  <jan.kratochvil@redhat.com>
            Eli Zaretskii  <eliz@gnu.org>
 
index 2d49e135091fa7e2c4b6abfc7e57a7a1ccaec3b1..dc8860af02d4dc20add4700d852a8dbb49306300 100644 (file)
@@ -6706,6 +6706,8 @@ the @code{list} command.  You can change this using @code{set listsize}:
 @item set listsize @var{count}
 Make the @code{list} command display @var{count} source lines (unless
 the @code{list} argument explicitly specifies some other number).
+Setting @var{count} to -1 means there's no limit and 0 means suppress
+display of source lines.
 
 @kindex show listsize
 @item show listsize
index 0ff0782d453a67d39c7436c3e313dcc31d6e3357..31e104fe4016cbddc504be43aae0e5d0913530ba 100644 (file)
@@ -1965,12 +1965,12 @@ The matching line number is also stored as the value of \"$_\"."));
       add_com_alias ("?", "reverse-search", class_files, 0);
     }
 
-  add_setshow_integer_cmd ("listsize", class_support, &lines_to_list, _("\
+  add_setshow_zuinteger_unlimited_cmd ("listsize", class_support,
+                                      &lines_to_list, _("\
 Set number of source lines gdb will list by default."), _("\
 Show number of source lines gdb will list by default."), NULL,
-                           NULL,
-                           show_lines_to_list,
-                           &setlist, &showlist);
+                                      NULL, show_lines_to_list,
+                                      &setlist, &showlist);
 
   add_cmd ("substitute-path", class_files, set_substitute_path_command,
            _("\
index 7fa1747275289e03b8147dfd3c3c7955881ec4d0..b458aba487916992a17f2068bf4c2640f15a5de3 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-17  Yao Qi  <yao@codesourcery.com>
+
+       * gdb.base/list.exp (set_listsize): Don't set arg to "unlimited"
+       when it is less than 0.
+
 2012-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        PR 14119
index 6b5b207d4b36dd1fd13cc8f5fdf74c12b3a2d4b4..9acb1c37cea0297dc94110c1d7fc7542deab3ba2 100644 (file)
@@ -62,7 +62,7 @@ proc set_listsize { arg } {
     if [gdb_test "set listsize $arg" ".*" "setting listsize to $arg #$set_listsize_count"] {
        return 0;
     }
-    if { $arg <= 0 } {
+    if { $arg < 0 } {
        set arg "unlimited";
     }
 
This page took 0.156 seconds and 4 git commands to generate.