]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Allow "unlimited" abbreviations
authorPedro Alves <palves@redhat.com>
Wed, 12 Jun 2019 23:06:52 +0000 (00:06 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 12 Jun 2019 23:09:11 +0000 (00:09 +0100)
Currently we can abbreviate "on/off/enable/disable/yes/no" in boolean
settings,

  (gdb) set non-stop of
  (gdb) set non-stop en

we can abbreviate the items of enumeration commands,

  (gdb) set print frame-arguments scal
  (gdb) set scheduler-locking rep

but we cannot abbreviate "unlimited" in integer commands.

 (gdb) set print elements u
 No symbol "u" in current context.

This commit fixes that.

Testcases will be in gdb.base/settings.exp and gdb.base/options.exp,
in following patches.

gdb/ChangeLog:
2019-06-13  Pedro Alves  <palves@redhat.com>

* cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations.

gdb/ChangeLog
gdb/cli/cli-setshow.c

index 538db3a06b760746f00401588cc7128659baede3..38e34b5dfd0f544d7236f0461999b04e9e3eb7fa 100644 (file)
@@ -1,3 +1,7 @@
+2019-06-13  Pedro Alves  <palves@redhat.com>
+
+       * cli/cli-setshow.c (is_unlimited_literal): Allow abbreviations.
+
 2019-06-13  Pedro Alves <palves@redhat.com>
 
        * ax-gdb.c (agent_command_1): Remove skip_spaces call.
index 5b87f905d0d3cd05ea59e17f84819e931ae2fdb7..96d7bf5c3c0bb05534c0dcc864745a7c20af1b63 100644 (file)
@@ -132,12 +132,16 @@ deprecated_show_value_hack (struct ui_file *ignore_file,
 static int
 is_unlimited_literal (const char *arg)
 {
-  size_t len = sizeof ("unlimited") - 1;
-
   arg = skip_spaces (arg);
 
-  return (strncmp (arg, "unlimited", len) == 0
-         && (isspace (arg[len]) || arg[len] == '\0'));
+  const char *p = skip_to_space (arg);
+
+  size_t len = p - arg;
+
+  if (len > 0 && strncmp ("unlimited", arg, len) == 0)
+    return true;
+
+  return false;
 }