diff options
author | Tom Tromey <tromey@redhat.com> | 2012-06-13 15:50:18 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2012-06-13 15:50:18 +0000 |
commit | 724254963b7ecf06fb4ebdc24f66859fc814c0c5 (patch) | |
tree | c5f6dd631761fae65a473106e650ceb92beba4bd /gdb/value.c | |
parent | 0581e13edef0280433d5c6d5175c6a7b740bdc4d (diff) | |
download | gdb-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.c | 23 |
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. */ |