summaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-06-13 15:50:18 +0000
committerTom Tromey <tromey@redhat.com>2012-06-13 15:50:18 +0000
commit724254963b7ecf06fb4ebdc24f66859fc814c0c5 (patch)
treec5f6dd631761fae65a473106e650ceb92beba4bd /gdb/value.c
parent0581e13edef0280433d5c6d5175c6a7b740bdc4d (diff)
downloadgdb-724254963b7ecf06fb4ebdc24f66859fc814c0c5.tar.gz
* breakpoint.c (condition_completer): New function.
(_initialize_breakpoint): Use it. * value.c (complete_internalvar): New function. * value.h (complete_internalvar): Declare. testsuite * gdb.base/condbreak.exp: Add tests for "condition" completion.
Diffstat (limited to 'gdb/value.c')
-rw-r--r--gdb/value.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gdb/value.c b/gdb/value.c
index c64e55b2162..a6bb71865bd 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1714,6 +1714,29 @@ lookup_only_internalvar (const char *name)
return NULL;
}
+/* Complete NAME by comparing it to the names of internal variables.
+ Returns a vector of newly allocated strings, or NULL if no matches
+ were found. */
+
+VEC (char_ptr) *
+complete_internalvar (const char *name)
+{
+ VEC (char_ptr) *result = NULL;
+ struct internalvar *var;
+ int len;
+
+ len = strlen (name);
+
+ for (var = internalvars; var; var = var->next)
+ if (strncmp (var->name, name, len) == 0)
+ {
+ char *r = xstrdup (var->name);
+
+ VEC_safe_push (char_ptr, result, r);
+ }
+
+ return result;
+}
/* Create an internal variable with name NAME and with a void value.
NAME should not normally include a dollar sign. */