From 724254963b7ecf06fb4ebdc24f66859fc814c0c5 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 13 Jun 2012 15:50:18 +0000 Subject: * 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. --- gdb/value.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gdb/value.c') 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. */ -- cgit v1.2.1