aboutsummaryrefslogtreecommitdiff
path: root/gdb/value.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-06-13 15:50:22 +0000
committerTom Tromey <tromey@redhat.com>2012-06-13 15:50:22 +0000
commitd55637df6923689396e58c3d789e82314f4826ec (patch)
tree09d54ca9515512c682efdaad9febaa1983c0d8ae /gdb/value.c
parent49c4e619f81a66545e2332dc218d9bf31bbb51ad (diff)
downloadgdb-d55637df6923689396e58c3d789e82314f4826ec.zip
gdb-d55637df6923689396e58c3d789e82314f4826ec.tar.gz
gdb-d55637df6923689396e58c3d789e82314f4826ec.tar.bz2
* 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 c64e55b..a6bb718 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. */