[PATCH v3 01/19] Add struct completer_data to the completion API.

Keith Seitz
2015-08-06T20:03:48Z

Differences in this revision:

1. Updated new completer[-related] functions reg_or_group_completer_1,
reg_or_group_completer, layout_completer, tui_reggroup_completer,
window_name_completer, focus_completer, and winheight_completer.

---

This patch is largely mechanical. It modifies the completion API so
that all completion functions take a new (pointer to a) structure,
which will (eventually) be used internally by the completer to perform
completion limiting.

gdb/ChangeLog

* completer.c (struct completer_data): Define.
* language.h (struct language_defn)
<la_make_symbol_completion_list>: Add struct completer_data
to argument list.
All users updated.
* symtab.c (COMPLETION_LIST_ADD_SYMBOL): Add CDATA argument.
Update all callers.
(MCOMPLETION_LIST_ADD_SYMBOL): Likewise.
(struct add_name_data) <completer_data>: New field.
(default_make_symbol_completion_list_break_on_1): Initialize
the above new field.
(struct add_partial_filename_data) <completer_data>: New field.
(make_source_files_completion_list): Initialize the above new
field.
---
gdb/ada-lang.c | 3 +
gdb/break-catch-syscall.c | 5 +-
gdb/breakpoint.c | 5 +-
gdb/cli/cli-decode.c | 11 ++--
gdb/command.h | 11 +++-
gdb/completer.c | 94 ++++++++++++++++++++-------------
gdb/completer.h | 25 ++++++---
gdb/corefile.c | 5 +-
gdb/cp-abi.c | 5 +-
gdb/f-lang.c | 6 +-
gdb/guile/scm-cmd.c | 3 +
gdb/infrun.c | 7 +-
gdb/interps.c | 3 +
gdb/language.h | 8 ++-
gdb/python/py-cmd.c | 12 ++--
gdb/remote-sim.c | 3 +
gdb/symtab.c | 130 ++++++++++++++++++++++++++++-----------------
gdb/symtab.h | 44 +++++++++------
gdb/tui/tui-layout.c | 5 +-
gdb/tui/tui-regs.c | 5 +-
gdb/tui/tui-win.c | 14 +++--
21 files changed, 252 insertions(+), 152 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9f9be64..9782b69 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -6266,7 +6266,8 @@ ada_complete_symbol_matcher (const char *name, void *user_data)
the entire command on which completion is made. */

static VEC (char_ptr) *
-ada_make_symbol_completion_list (const char *text0, const char *word,
+ada_make_symbol_completion_list (struct completer_data *cdata,
+ const char *text0, const char *word,
enum type_code code)
{
char *text;
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 1718f49..4677132 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -592,12 +592,13 @@ catching_syscall_number (int syscall_number)

/* Complete syscall names. Used by "catch syscall". */
static VEC (char_ptr) *
-catch_syscall_completer (struct cmd_list_element *cmd,
+catch_syscall_completer (struct completer_data *cdata,
+ struct cmd_list_element *cmd,
const char *text, const char *word)
{
const char **list = get_syscall_names (get_current_arch ());
VEC (char_ptr) *retlist
- = (list == NULL) ? NULL : complete_on_enum (list, word, word);
+ = (list == NULL) ? NULL : complete_on_enum (cdata, list, word, word);

xfree (list);
return retlist;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 125b22f..70569df 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1033,7 +1033,8 @@ set_breakpoint_condition (struct breakpoint *b, const char *exp,
/* Completion for the "condition" command. */

static VEC (char_ptr) *
-condition_completer (struct cmd_list_element *cmd,
+condition_completer (struct completer_data *cdata,
+ struct cmd_list_element *cmd,
const char *text, const char *word)
{
const char *space;
@@ -1072,7 +1073,7 @@ condition_completer (struct cmd_list_element *cmd,

/* We're completing the expression part. */
text = skip_spaces_const (space);
- return expression_completer (cmd, text, word);
+ return expression_completer (cdata, cmd, text, word);
}

/* condition N EXP -- set break condition of breakpoint N to EXP. */
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index e406157..3415b77 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -648,7 +648,8 @@ add_setshow_optional_filename_cmd (const char *name, enum command_class theclass
support a special "unlimited" value. */

static VEC (char_ptr) *
-integer_unlimited_completer (struct cmd_list_element *ignore,
+integer_unlimited_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
static const char * const keywords[] =
@@ -657,7 +658,7 @@ integer_unlimited_completer (struct cmd_list_element *ignore,
NULL,
};

- return complete_on_enum (keywords, text, word);
+ return complete_on_enum (cdata, keywords, text, word);
}

/* Add element named NAME to both the set and show command LISTs (the
@@ -1765,7 +1766,8 @@ lookup_cmd_composition (const char *text,
"oobar"; if WORD is "baz/foo", return "baz/foobar". */

VEC (char_ptr) *
-complete_on_cmdlist (struct cmd_list_element *list,
+complete_on_cmdlist (struct completer_data *cdata,
+ struct cmd_list_element *list,
const char *text, const char *word,
int ignore_help_classes)
{
@@ -1835,7 +1837,8 @@ complete_on_cmdlist (struct cmd_list_element *list,
"oobar"; if WORD is "baz/foo", return "baz/foobar". */

VEC (char_ptr) *
-complete_on_enum (const char *const *enumlist,
+complete_on_enum (struct completer_data *cdata,
+ const char *const *enumlist,
const char *text, const char *word)
{
VEC (char_ptr) *matchlist = NULL;
diff --git a/gdb/command.h b/gdb/command.h
index bdf625b..b2aeb30 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -23,6 +23,8 @@
/* This file defines the public interface for any code wanting to
create commands. */

+struct completer_data;
+
/* Command classes are top-level categories into which commands are
broken down for "help" purposes.

@@ -156,7 +158,8 @@ typedef void cmd_sfunc_ftype (char *args, int from_tty,
extern void set_cmd_sfunc (struct cmd_list_element *cmd,
cmd_sfunc_ftype *sfunc);

-typedef VEC (char_ptr) *completer_ftype (struct cmd_list_element *,
+typedef VEC (char_ptr) *completer_ftype (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

typedef void completer_ftype_void (struct cmd_list_element *,
@@ -225,10 +228,12 @@ extern struct cmd_list_element *add_info (const char *,
extern struct cmd_list_element *add_info_alias (const char *, const char *,
int);

-extern VEC (char_ptr) *complete_on_cmdlist (struct cmd_list_element *,
+extern VEC (char_ptr) *complete_on_cmdlist (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *, int);

-extern VEC (char_ptr) *complete_on_enum (const char *const *enumlist,
+extern VEC (char_ptr) *complete_on_enum (struct completer_data *,
+ const char *const *enumlist,
const char *, const char *);

/* Functions that implement commands about CLI commands. */
diff --git a/gdb/completer.c b/gdb/completer.c
index d1ebf67..476f9f2 100644
--- a/gdb/completer.c
+++ b/gdb/completer.c
@@ -87,6 +87,15 @@ static char *gdb_completer_file_name_break_characters = " \t\n*|\"';:?><";
we can't include '"' because the gdb C parser treats such quoted
sequences as strings. */
static char *gdb_completer_quote_characters = "'";
+
+/* A structure holding completion-specific call data. */
+
+struct completer_data
+{
+ /* The completion tracker being used by the completer. */
+ completion_tracker_t tracker;
+};
+
\f
/* Accessor for some completer data that may interest other files. */

@@ -108,7 +117,8 @@ readline_line_completion_function (const char *text, int matches)
/* This can be used for functions which don't want to complete on
symbols but don't want to complete on anything else either. */
VEC (char_ptr) *
-noop_completer (struct cmd_list_element *ignore,
+noop_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *prefix)
{
return NULL;
@@ -116,7 +126,8 @@ noop_completer (struct cmd_list_element *ignore,

/* Complete on filenames. */
VEC (char_ptr) *
-filename_completer (struct cmd_list_element *ignore,
+filename_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
int subsequent_name;
@@ -185,7 +196,8 @@ filename_completer (struct cmd_list_element *ignore,
etc. */

VEC (char_ptr) *
-location_completer (struct cmd_list_element *ignore,
+location_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
int n_syms, n_files, ix;
@@ -261,18 +273,18 @@ location_completer (struct cmd_list_element *ignore,
symbols as well as on files. */
if (colon)
{
- list = make_file_symbol_completion_list (symbol_start, word,
+ list = make_file_symbol_completion_list (cdata, symbol_start, word,
file_to_match);
xfree (file_to_match);
}
else
{
- list = make_symbol_completion_list (symbol_start, word);
+ list = make_symbol_completion_list (cdata, symbol_start, word);
/* If text includes characters which cannot appear in a file
name, they cannot be asking for completion on files. */
if (strcspn (text,
gdb_completer_file_name_break_characters) == text_len)
- fn_list = make_source_files_completion_list (text, text);
+ fn_list = make_source_files_completion_list (cdata, text, text);
}

n_syms = VEC_length (char_ptr, list);
@@ -327,7 +339,7 @@ location_completer (struct cmd_list_element *ignore,
{
/* No completions at all. As the final resort, try completing
on the entire text as a symbol. */
- list = make_symbol_completion_list (orig_text, word);
+ list = make_symbol_completion_list (cdata, orig_text, word);
}

return list;
@@ -337,7 +349,8 @@ location_completer (struct cmd_list_element *ignore,
method names from TYPE, a struct or union type, to the array
OUTPUT. */
static void
-add_struct_fields (struct type *type, VEC (char_ptr) **output,
+add_struct_fields (struct completer_data *cdata,
+ struct type *type, VEC (char_ptr) **output,
char *fieldname, int namelen)
{
int i;
@@ -348,7 +361,7 @@ add_struct_fields (struct type *type, VEC (char_ptr) **output,
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
if (i < TYPE_N_BASECLASSES (type))
- add_struct_fields (TYPE_BASECLASS (type, i),
+ add_struct_fields (cdata, TYPE_BASECLASS (type, i),
output, fieldname, namelen);
else if (TYPE_FIELD_NAME (type, i))
{
@@ -362,7 +375,7 @@ add_struct_fields (struct type *type, VEC (char_ptr) **output,
else if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION)
{
/* Recurse into anonymous unions. */
- add_struct_fields (TYPE_FIELD_TYPE (type, i),
+ add_struct_fields (cdata, TYPE_FIELD_TYPE (type, i),
output, fieldname, namelen);
}
}
@@ -390,7 +403,8 @@ add_struct_fields (struct type *type, VEC (char_ptr) **output,
names, but some language parsers also have support for completing
field names. */
VEC (char_ptr) *
-expression_completer (struct cmd_list_element *ignore,
+expression_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
struct type *type = NULL;
@@ -428,7 +442,7 @@ expression_completer (struct cmd_list_element *ignore,
int flen = strlen (fieldname);
VEC (char_ptr) *result = NULL;

- add_struct_fields (type, &result, fieldname, flen);
+ add_struct_fields (cdata, type, &result, fieldname, flen);
xfree (fieldname);
return result;
}
@@ -438,7 +452,8 @@ expression_completer (struct cmd_list_element *ignore,
VEC (char_ptr) *result;
struct cleanup *cleanup = make_cleanup (xfree, fieldname);

- result = make_symbol_completion_type (fieldname, fieldname, code);
+ result
+ = make_symbol_completion_type (cdata, fieldname, fieldname, code);
do_cleanups (cleanup);
return result;
}
@@ -452,7 +467,7 @@ expression_completer (struct cmd_list_element *ignore,
;

/* Not ideal but it is what we used to do before... */
- return location_completer (ignore, p, word);
+ return location_completer (cdata, ignore, p, word);
}

/* See definition in completer.h. */
@@ -530,8 +545,8 @@ complete_line_internal_reason;
*/

static VEC (char_ptr) *
-complete_line_internal (const char *text,
- const char *line_buffer, int point,
+complete_line_internal (struct completer_data *cdata,
+ const char *text, const char *line_buffer, int point,
complete_line_internal_reason reason)
{
VEC (char_ptr) *list = NULL;
@@ -616,13 +631,13 @@ complete_line_internal (const char *text,
if (result_list)
{
if (reason != handle_brkchars)
- list = complete_on_cmdlist (*result_list->prefixlist, p,
- word, ignore_help_classes);
+ list = complete_on_cmdlist (cdata, *result_list->prefixlist,
+ p, word, ignore_help_classes);
}
else
{
if (reason != handle_brkchars)
- list = complete_on_cmdlist (cmdlist, p, word,
+ list = complete_on_cmdlist (cdata, cmdlist, p, word,
ignore_help_classes);
}
/* Ensure that readline does the right thing with respect to
@@ -649,8 +664,8 @@ complete_line_internal (const char *text,
/* It is a prefix command; what comes after it is
a subcommand (e.g. "info "). */
if (reason != handle_brkchars)
- list = complete_on_cmdlist (*c->prefixlist, p, word,
- ignore_help_classes);
+ list = complete_on_cmdlist (cdata, *c->prefixlist, p,
+ word, ignore_help_classes);

/* Ensure that readline does the right thing
with respect to inserting quotes. */
@@ -662,7 +677,7 @@ complete_line_internal (const char *text,
else if (c->enums)
{
if (reason != handle_brkchars)
- list = complete_on_enum (c->enums, p, word);
+ list = complete_on_enum (cdata, c->enums, p, word);
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
@@ -702,7 +717,7 @@ complete_line_internal (const char *text,
&& c->completer_handle_brkchars != NULL)
(*c->completer_handle_brkchars) (c, p, word);
if (reason != handle_brkchars && c->completer != NULL)
- list = (*c->completer) (c, p, word);
+ list = (*c->completer) (cdata, c, p, word);
}
}
else
@@ -724,7 +739,7 @@ complete_line_internal (const char *text,
}

if (reason != handle_brkchars)
- list = complete_on_cmdlist (result_list, q, word,
+ list = complete_on_cmdlist (cdata, result_list, q, word,
ignore_help_classes);

/* Ensure that readline does the right thing
@@ -748,7 +763,7 @@ complete_line_internal (const char *text,
else if (c->enums)
{
if (reason != handle_brkchars)
- list = complete_on_enum (c->enums, p, word);
+ list = complete_on_enum (cdata, c->enums, p, word);
}
else
{
@@ -778,7 +793,7 @@ complete_line_internal (const char *text,
&& c->completer_handle_brkchars != NULL)
(*c->completer_handle_brkchars) (c, p, word);
if (reason != handle_brkchars && c->completer != NULL)
- list = (*c->completer) (c, p, word);
+ list = (*c->completer) (cdata, c, p, word);
}
}
}
@@ -886,7 +901,7 @@ complete_line (const char *text, const char *line_buffer, int point)

if (max_completions == 0)
return NULL;
- list = complete_line_internal (text, line_buffer, point,
+ list = complete_line_internal (NULL, text, line_buffer, point,
handle_completions);
if (max_completions < 0)
return list;
@@ -933,17 +948,19 @@ complete_line (const char *text, const char *line_buffer, int point)

/* Complete on command names. Used by "help". */
VEC (char_ptr) *
-command_completer (struct cmd_list_element *ignore,
+command_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
- return complete_line_internal (word, text,
+ return complete_line_internal (cdata, word, text,
strlen (text), handle_help);
}

/* Complete on signals. */

VEC (char_ptr) *
-signal_completer (struct cmd_list_element *ignore,
+signal_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
VEC (char_ptr) *return_val = NULL;
@@ -983,7 +1000,8 @@ enum reg_completer_targets
in TARGETS. At least one bit in TARGETS must be set. */

static VEC (char_ptr) *
-reg_or_group_completer_1 (struct cmd_list_element *ignore,
+reg_or_group_completer_1 (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word,
enum reg_completer_targets targets)
{
@@ -1029,10 +1047,11 @@ reg_or_group_completer_1 (struct cmd_list_element *ignore,
/* Perform completion on register and reggroup names. */

VEC (char_ptr) *
-reg_or_group_completer (struct cmd_list_element *ignore,
+reg_or_group_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
- return reg_or_group_completer_1 (ignore, text, word,
+ return reg_or_group_completer_1 (cdata, ignore, text, word,
(complete_register_names
| complete_reggroup_names));
}
@@ -1040,10 +1059,11 @@ reg_or_group_completer (struct cmd_list_element *ignore,
/* Perform completion on reggroup names. */

VEC (char_ptr) *
-reggroup_completer (struct cmd_list_element *ignore,
+reggroup_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
- return reg_or_group_completer_1 (ignore, text, word,
+ return reg_or_group_completer_1 (cdata, ignore, text, word,
complete_reggroup_names);
}

@@ -1055,8 +1075,8 @@ gdb_completion_word_break_characters (void)
{
VEC (char_ptr) *list;

- list = complete_line_internal (rl_line_buffer, rl_line_buffer, rl_point,
- handle_brkchars);
+ list = complete_line_internal (NULL, rl_line_buffer, rl_line_buffer,
+ rl_point, handle_brkchars);
gdb_assert (list == NULL);
return rl_completer_word_break_characters;
}
diff --git a/gdb/completer.h b/gdb/completer.h
index 6c1f257..7139c0a 100644
--- a/gdb/completer.h
+++ b/gdb/completer.h
@@ -23,6 +23,7 @@
/* Types of functions in struct match_list_displayer. */

struct match_list_displayer;
+struct completer_data;

typedef void mld_crlf_ftype (const struct match_list_displayer *);
typedef void mld_putch_ftype (const struct match_list_displayer *, int);
@@ -75,28 +76,36 @@ extern VEC (char_ptr) *complete_line (const char *text,
extern char *readline_line_completion_function (const char *text,
int matches);

-extern VEC (char_ptr) *noop_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *noop_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *filename_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *filename_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *expression_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *expression_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *location_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *location_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *command_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *command_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *signal_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *signal_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *reg_or_group_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *reg_or_group_completer (struct completer_data *,
+ struct cmd_list_element *,
const char *, const char *);

-extern VEC (char_ptr) *reggroup_completer (struct cmd_list_element *,
+extern VEC (char_ptr) *reggroup_completer (struct completer_data *cdata,
+ struct cmd_list_element *,
const char *, const char *);

extern char *get_gdb_completer_quote_characters (void);
diff --git a/gdb/corefile.c b/gdb/corefile.c
index 5246f71..41b7cb0 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -468,7 +468,8 @@ set_gnutarget_command (char *ignore, int from_tty,
/* A completion function for "set gnutarget". */

static VEC (char_ptr) *
-complete_set_gnutarget (struct cmd_list_element *cmd,
+complete_set_gnutarget (struct completer_data *cdata,
+ struct cmd_list_element *cmd,
const char *text, const char *word)
{
static const char **bfd_targets;
@@ -486,7 +487,7 @@ complete_set_gnutarget (struct cmd_list_element *cmd,
bfd_targets[last + 1] = NULL;
}

- return complete_on_enum (bfd_targets, text, word);
+ return complete_on_enum (cdata, bfd_targets, text, word);
}

/* Set the gnutarget. */
diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index b8af8f0..504bb20 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -359,7 +359,8 @@ set_cp_abi_cmd (char *args, int from_tty)
/* A completion function for "set cp-abi". */

static VEC (char_ptr) *
-cp_abi_completer (struct cmd_list_element *ignore,
+cp_abi_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
static const char **cp_abi_names;
@@ -374,7 +375,7 @@ cp_abi_completer (struct cmd_list_element *ignore,
cp_abi_names[i] = NULL;
}

- return complete_on_enum (cp_abi_names, text, word);
+ return complete_on_enum (cdata, cp_abi_names, text, word);
}

/* Show the currently selected C++ ABI. */
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index e4deeb9..15c51d9 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -229,10 +229,12 @@ f_word_break_characters (void)
class. */

static VEC (char_ptr) *
-f_make_symbol_completion_list (const char *text, const char *word,
+f_make_symbol_completion_list (struct completer_data *cdata,
+ const char *text, const char *word,
enum type_code code)
{
- return default_make_symbol_completion_list_break_on (text, word, ":", code);
+ return default_make_symbol_completion_list_break_on (cdata, text, word,
+ ":", code);
}

const struct language_defn f_language_defn =
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 4477b98..58c79c8 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -378,7 +378,8 @@ cmdscm_add_completion (SCM completion, VEC (char_ptr) **result)
/* Called by gdb for command completion. */

static VEC (char_ptr) *
-cmdscm_completer (struct cmd_list_element *command,
+cmdscm_completer (struct completer_data *cdata,
+ struct cmd_list_element *command,
const char *text, const char *word)
{
command_smob *c_smob/*obj*/ = (command_smob *) get_cmd_context (command);
diff --git a/gdb/infrun.c b/gdb/infrun.c
index a2e7cfc..d858b28 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -7066,7 +7066,8 @@ Are you sure you want to change it? "),
/* Complete the "handle" command. */

static VEC (char_ptr) *
-handle_completer (struct cmd_list_element *ignore,
+handle_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
VEC (char_ptr) *vec_signals, *vec_keywords, *return_val;
@@ -7084,8 +7085,8 @@ handle_completer (struct cmd_list_element *ignore,
NULL,
};

- vec_signals = signal_completer (ignore, text, word);
- vec_keywords = complete_on_enum (keywords, word, word);
+ vec_signals = signal_completer (cdata, ignore, text, word);
+ vec_keywords = complete_on_enum (cdata, keywords, word, word);

return_val = VEC_merge (char_ptr, vec_signals, vec_keywords);
VEC_free (char_ptr, vec_signals);
diff --git a/gdb/interps.c b/gdb/interps.c
index d825e14..2cfe92b 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -435,7 +435,8 @@ interpreter_exec_cmd (char *args, int from_tty)

/* List the possible interpreters which could complete the given text. */
static VEC (char_ptr) *
-interpreter_completer (struct cmd_list_element *ignore,
+interpreter_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
int textlen;
diff --git a/gdb/language.h b/gdb/language.h
index 4ecb103..954b4a8 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -302,9 +302,11 @@ struct language_defn
completion is being made. If CODE is TYPE_CODE_UNDEF, then all
symbols should be examined; otherwise, only STRUCT_DOMAIN
symbols whose type has a code of CODE should be matched. */
- VEC (char_ptr) *(*la_make_symbol_completion_list) (const char *text,
- const char *word,
- enum type_code code);
+ VEC (char_ptr) *
+ (*la_make_symbol_completion_list) (struct completer_data *,
+ const char *text,
+ const char *word,
+ enum type_code code);

/* The per-architecture (OS/ABI) language information. */
void (*la_language_arch_info) (struct gdbarch *,
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index b11fc32..21d842e 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -237,7 +237,8 @@ cmdpy_function (struct cmd_list_element *command, char *args, int from_tty)
call. */

static PyObject *
-cmdpy_completer_helper (struct cmd_list_element *command,
+cmdpy_completer_helper (struct completer_data *cdata,
+ struct cmd_list_element *command,
const char *text, const char *word)
{
cmdpy_object *obj = (cmdpy_object *) get_cmd_context (command);
@@ -293,7 +294,7 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,

/* Calling our helper to obtain the PyObject of the Python
function. */
- resultobj = cmdpy_completer_helper (command, text, word);
+ resultobj = cmdpy_completer_helper (NULL, command, text, word);

/* Check if there was an error. */
if (resultobj == NULL)
@@ -330,7 +331,8 @@ cmdpy_completer_handle_brkchars (struct cmd_list_element *command,
/* Called by gdb for command completion. */

static VEC (char_ptr) *
-cmdpy_completer (struct cmd_list_element *command,
+cmdpy_completer (struct completer_data *cdata,
+ struct cmd_list_element *command,
const char *text, const char *word)
{
PyObject *resultobj = NULL;
@@ -341,7 +343,7 @@ cmdpy_completer (struct cmd_list_element *command,

/* Calling our helper to obtain the PyObject of the Python
function. */
- resultobj = cmdpy_completer_helper (command, text, word);
+ resultobj = cmdpy_completer_helper (cdata, command, text, word);

/* If the result object of calling the Python function is NULL, it
means that there was an error. In this case, just give up and
@@ -362,7 +364,7 @@ cmdpy_completer (struct cmd_list_element *command,
PyErr_Clear ();
}
else if (value >= 0 && value < (long) N_COMPLETERS)
- result = completers[value].completer (command, text, word);
+ result = completers[value].completer (cdata, command, text, word);
}
else
{
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 82c129d..0a8997a 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -1223,7 +1223,8 @@ simulator_command (char *args, int from_tty)
}

static VEC (char_ptr) *
-sim_command_completer (struct cmd_list_element *ignore, const char *text,
+sim_command_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore, const char *text,
const char *word)
{
struct sim_inferior_data *sim_data;
diff --git a/gdb/symtab.c b/gdb/symtab.c
index 8aeabe86..f4407a0 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -5036,13 +5036,15 @@ do_free_completion_list (void *list)

static VEC (char_ptr) *return_val;

-#define COMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \
- completion_list_add_name \
- (SYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))
+#define COMPLETION_LIST_ADD_SYMBOL(cdata, symbol, sym_text, len, \
+ text, word) \
+ completion_list_add_name \
+ ((cdata), SYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))

-#define MCOMPLETION_LIST_ADD_SYMBOL(symbol, sym_text, len, text, word) \
- completion_list_add_name \
- (MSYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))
+#define MCOMPLETION_LIST_ADD_SYMBOL(cdata, symbol, sym_text, len, \
+ text, word) \
+ completion_list_add_name \
+ (cdata, MSYMBOL_NATURAL_NAME (symbol), (sym_text), (len), (text), (word))

/* Tracker for how many unique completions have been generated. Used
to terminate completion list generation early if the list has grown
@@ -5058,7 +5060,8 @@ static completion_tracker_t completion_tracker;
characters. If so, add it to the current completion list. */

static void
-completion_list_add_name (const char *symname,
+completion_list_add_name (struct completer_data *cdata,
+ const char *symname,
const char *sym_text, int sym_text_len,
const char *text, const char *word)
{
@@ -5117,7 +5120,8 @@ completion_list_add_name (const char *symname,
again and feed all the selectors into the mill. */

static void
-completion_list_objc_symbol (struct minimal_symbol *msymbol,
+completion_list_objc_symbol (struct completer_data *cdata,
+ struct minimal_symbol *msymbol,
const char *sym_text, int sym_text_len,
const char *text, const char *word)
{
@@ -5135,7 +5139,8 @@ completion_list_objc_symbol (struct minimal_symbol *msymbol,

if (sym_text[0] == '[')
/* Complete on shortened method method. */
- completion_list_add_name (method + 1, sym_text, sym_text_len, text, word);
+ completion_list_add_name (cdata, method + 1, sym_text, sym_text_len,
+ text, word);

while ((strlen (method) + 1) >= tmplen)
{
@@ -5156,9 +5161,11 @@ completion_list_objc_symbol (struct minimal_symbol *msymbol,
memcpy (tmp, method, (category - method));
tmp[category - method] = ' ';
memcpy (tmp + (category - method) + 1, selector, strlen (selector) + 1);
- completion_list_add_name (tmp, sym_text, sym_text_len, text, word);
+ completion_list_add_name (cdata, tmp, sym_text, sym_text_len,
+ text, word);
if (sym_text[0] == '[')
- completion_list_add_name (tmp + 1, sym_text, sym_text_len, text, word);
+ completion_list_add_name (cdata, tmp + 1, sym_text, sym_text_len,
+ text, word);
}

if (selector != NULL)
@@ -5169,7 +5176,8 @@ completion_list_objc_symbol (struct minimal_symbol *msymbol,
if (tmp2 != NULL)
*tmp2 = '\0';

- completion_list_add_name (tmp, sym_text, sym_text_len, text, word);
+ completion_list_add_name (cdata, tmp, sym_text, sym_text_len,
+ text, word);
}
}

@@ -5220,7 +5228,8 @@ language_search_unquoted_string (const char *text, const char *p)
}

static void
-completion_list_add_fields (struct symbol *sym, const char *sym_text,
+completion_list_add_fields (struct completer_data *cdata,
+ struct symbol *sym, const char *sym_text,
int sym_text_len, const char *text,
const char *word)
{
@@ -5233,7 +5242,7 @@ completion_list_add_fields (struct symbol *sym, const char *sym_text,
if (c == TYPE_CODE_UNION || c == TYPE_CODE_STRUCT)
for (j = TYPE_N_BASECLASSES (t); j < TYPE_NFIELDS (t); j++)
if (TYPE_FIELD_NAME (t, j))
- completion_list_add_name (TYPE_FIELD_NAME (t, j),
+ completion_list_add_name (cdata, TYPE_FIELD_NAME (t, j),
sym_text, sym_text_len, text, word);
}
}
@@ -5249,6 +5258,9 @@ struct add_name_data
const char *text;
const char *word;

+ /* Completion data used by the completer function. */
+ struct completer_data *completer_data;
+
/* Extra argument required for add_symtab_completions. */
enum type_code code;
};
@@ -5263,7 +5275,7 @@ add_macro_name (const char *name, const struct macro_definition *ignore,
{
struct add_name_data *datum = (struct add_name_data *) user_data;

- completion_list_add_name (name,
+ completion_list_add_name (datum->completer_data, name,
datum->sym_text, datum->sym_text_len,
datum->text, datum->word);
}
@@ -5281,7 +5293,8 @@ symbol_completion_matcher (const char *name, void *user_data)
/* Add matching symbols from SYMTAB to the current completion list. */

static void
-add_symtab_completions (struct compunit_symtab *cust,
+add_symtab_completions (struct completer_data *cdata,
+ struct compunit_symtab *cust,
const char *sym_text, int sym_text_len,
const char *text, const char *word,
enum type_code code)
@@ -5300,7 +5313,7 @@ add_symtab_completions (struct compunit_symtab *cust,
if (code == TYPE_CODE_UNDEF
|| (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& TYPE_CODE (SYMBOL_TYPE (sym)) == code))
- COMPLETION_LIST_ADD_SYMBOL (sym,
+ COMPLETION_LIST_ADD_SYMBOL (cdata, sym,
sym_text, sym_text_len,
text, word);
}
@@ -5316,14 +5329,15 @@ symtab_expansion_callback (struct compunit_symtab *symtab,
{
struct add_name_data *datum = (struct add_name_data *) user_data;

- add_symtab_completions (symtab,
+ add_symtab_completions (datum->completer_data, symtab,
datum->sym_text, datum->sym_text_len,
datum->text, datum->word,
datum->code);
}

static void
-default_make_symbol_completion_list_break_on_1 (const char *text,
+default_make_symbol_completion_list_break_on_1 (struct completer_data *cdata,
+ const char *text,
const char *word,
const char *break_on,
enum type_code code)
@@ -5423,6 +5437,7 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
datum.text = text;
datum.word = word;
datum.code = code;
+ datum.completer_data = cdata;

/* At this point scan through the misc symbol vectors and add each
symbol you find to the list. Eventually we want to ignore
@@ -5434,17 +5449,17 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
ALL_MSYMBOLS (objfile, msymbol)
{
QUIT;
- MCOMPLETION_LIST_ADD_SYMBOL (msymbol, sym_text, sym_text_len, text,
- word);
+ MCOMPLETION_LIST_ADD_SYMBOL (cdata, msymbol, sym_text, sym_text_len,
+ text, word);

- completion_list_objc_symbol (msymbol, sym_text, sym_text_len, text,
- word);
+ completion_list_objc_symbol (cdata, msymbol, sym_text, sym_text_len,
+ text, word);
}
}

/* Add completions for all currently loaded symbol tables. */
ALL_COMPUNITS (objfile, cust)
- add_symtab_completions (cust, sym_text, sym_text_len, text, word,
+ add_symtab_completions (cdata, cust, sym_text, sym_text_len, text, word,
code);

/* Look through the partial symtabs for all symbols which begin
@@ -5472,15 +5487,15 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
{
if (code == TYPE_CODE_UNDEF)
{
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text,
- word);
- completion_list_add_fields (sym, sym_text, sym_text_len, text,
- word);
+ COMPLETION_LIST_ADD_SYMBOL (cdata, sym, sym_text,
+ sym_text_len, text, word);
+ completion_list_add_fields (cdata, sym, sym_text,
+ sym_text_len, text, word);
}
else if (SYMBOL_DOMAIN (sym) == STRUCT_DOMAIN
&& TYPE_CODE (SYMBOL_TYPE (sym)) == code)
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text,
- word);
+ COMPLETION_LIST_ADD_SYMBOL (cdata, sym, sym_text, sym_text_len,
+ text, word);
}

/* Stop when we encounter an enclosing function. Do not stop for
@@ -5497,11 +5512,16 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
{
if (surrounding_static_block != NULL)
ALL_BLOCK_SYMBOLS (surrounding_static_block, iter, sym)
- completion_list_add_fields (sym, sym_text, sym_text_len, text, word);
-
+ {
+ completion_list_add_fields (cdata, sym, sym_text, sym_text_len,
+ text, word);
+ }
if (surrounding_global_block != NULL)
ALL_BLOCK_SYMBOLS (surrounding_global_block, iter, sym)
- completion_list_add_fields (sym, sym_text, sym_text_len, text, word);
+ {
+ completion_list_add_fields (cdata, sym, sym_text, sym_text_len,
+ text, word);
+ }
}

/* Skip macros if we are completing a struct tag -- arguable but
@@ -5534,7 +5554,8 @@ default_make_symbol_completion_list_break_on_1 (const char *text,
}

VEC (char_ptr) *
-default_make_symbol_completion_list_break_on (const char *text,
+default_make_symbol_completion_list_break_on (struct completer_data *cdata,
+ const char *text,
const char *word,
const char *break_on,
enum type_code code)
@@ -5546,7 +5567,7 @@ default_make_symbol_completion_list_break_on (const char *text,

TRY
{
- default_make_symbol_completion_list_break_on_1 (text, word,
+ default_make_symbol_completion_list_break_on_1 (cdata, text, word,
break_on, code);
}
CATCH (except, RETURN_MASK_ERROR)
@@ -5561,10 +5582,12 @@ default_make_symbol_completion_list_break_on (const char *text,
}

VEC (char_ptr) *
-default_make_symbol_completion_list (const char *text, const char *word,
+default_make_symbol_completion_list (struct completer_data *cdata,
+ const char *text, const char *word,
enum type_code code)
{
- return default_make_symbol_completion_list_break_on (text, word, "", code);
+ return default_make_symbol_completion_list_break_on (cdata, text, word, "",
+ code);
}

/* Return a vector of all symbols (regardless of class) which begin by
@@ -5572,9 +5595,10 @@ default_make_symbol_completion_list (const char *text, const char *word,
is NULL. */

VEC (char_ptr) *
-make_symbol_completion_list (const char *text, const char *word)
+make_symbol_completion_list (struct completer_data *cdata,
+ const char *text, const char *word)
{
- return current_language->la_make_symbol_completion_list (text, word,
+ return current_language->la_make_symbol_completion_list (cdata, text, word,
TYPE_CODE_UNDEF);
}

@@ -5582,30 +5606,33 @@ make_symbol_completion_list (const char *text, const char *word)
symbols whose type code is CODE. */

VEC (char_ptr) *
-make_symbol_completion_type (const char *text, const char *word,
- enum type_code code)
+make_symbol_completion_type (struct completer_data *cdata, const char *text,
+ const char *word, enum type_code code)
{
gdb_assert (code == TYPE_CODE_UNION
|| code == TYPE_CODE_STRUCT
|| code == TYPE_CODE_ENUM);
- return current_language->la_make_symbol_completion_list (text, word, code);
+ return current_language->la_make_symbol_completion_list (cdata, text, word,
+ code);
}

/* Like make_symbol_completion_list, but suitable for use as a
completion function. */

VEC (char_ptr) *
-make_symbol_completion_list_fn (struct cmd_list_element *ignore,
+make_symbol_completion_list_fn (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
- return make_symbol_completion_list (text, word);
+ return make_symbol_completion_list (cdata, text, word);
}

/* Like make_symbol_completion_list, but returns a list of symbols
defined in a source file FILE. */

VEC (char_ptr) *
-make_file_symbol_completion_list (const char *text, const char *word,
+make_file_symbol_completion_list (struct completer_data *cdata,
+ const char *text, const char *word,
const char *srcfile)
{
struct symbol *sym;
@@ -5687,13 +5714,15 @@ make_file_symbol_completion_list (const char *text, const char *word,
b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
+ COMPLETION_LIST_ADD_SYMBOL (cdata, sym, sym_text, sym_text_len,
+ text, word);
}

b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word);
+ COMPLETION_LIST_ADD_SYMBOL (cdata, sym, sym_text, sym_text_len,
+ text, word);
}

return (return_val);
@@ -5759,6 +5788,9 @@ struct add_partial_filename_data
const char *word;
int text_len;
VEC (char_ptr) **list;
+
+ /* Completion data used by the completer function. */
+ struct completer_data *completer_data;
};

/* A callback for map_partial_symbol_filenames. */
@@ -5795,7 +5827,8 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname,
NULL. */

VEC (char_ptr) *
-make_source_files_completion_list (const char *text, const char *word)
+make_source_files_completion_list (struct completer_data *cdata,
+ const char *text, const char *word)
{
struct compunit_symtab *cu;
struct symtab *s;
@@ -5846,6 +5879,7 @@ make_source_files_completion_list (const char *text, const char *word)
datum.word = word;
datum.text_len = text_len;
datum.list = &list;
+ datum.completer_data = cdata;
map_symbol_filenames (maybe_add_partial_symtab_filename, &datum,
0 /*need_fullname*/);

diff --git a/gdb/symtab.h b/gdb/symtab.h
index 61fc8c5..018852c 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -38,6 +38,7 @@ struct program_space;
struct language_defn;
struct probe;
struct common_block;
+struct completer_data;

/* Some of the structures in this file are space critical.
The space-critical structures are:
@@ -1454,24 +1455,31 @@ extern void forget_cached_source_info (void);
extern void select_source_symtab (struct symtab *);

extern VEC (char_ptr) *default_make_symbol_completion_list_break_on
- (const char *text, const char *word, const char *break_on,
- enum type_code code);
-extern VEC (char_ptr) *default_make_symbol_completion_list (const char *,
- const char *,
- enum type_code);
-extern VEC (char_ptr) *make_symbol_completion_list (const char *, const char *);
-extern VEC (char_ptr) *make_symbol_completion_type (const char *, const char *,
- enum type_code);
-extern VEC (char_ptr) *make_symbol_completion_list_fn (struct cmd_list_element *,
- const char *,
- const char *);
-
-extern VEC (char_ptr) *make_file_symbol_completion_list (const char *,
- const char *,
- const char *);
-
-extern VEC (char_ptr) *make_source_files_completion_list (const char *,
- const char *);
+ (struct completer_data *cdata, const char *text, const char *word,
+ const char *break_on, enum type_code code);
+extern VEC (char_ptr) *
+ default_make_symbol_completion_list (struct completer_data *,
+ const char *, const char *,
+ enum type_code);
+extern VEC (char_ptr) *
+ make_symbol_completion_list (struct completer_data *, const char *,
+ const char *);
+extern VEC (char_ptr) *
+ make_symbol_completion_type (struct completer_data *,
+ const char *, const char *,
+ enum type_code);
+extern VEC (char_ptr) *
+ make_symbol_completion_list_fn (struct completer_data *,
+ struct cmd_list_element *,
+ const char *, const char *);
+
+extern VEC (char_ptr) *
+ make_file_symbol_completion_list (struct completer_data *,
+ const char *, const char *, const char *);
+
+extern VEC (char_ptr) *
+ make_source_files_completion_list (struct completer_data *, const char *,
+ const char *);

/* symtab.c */

diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c
index 0255c39..8d420894 100644
--- a/gdb/tui/tui-layout.c
+++ b/gdb/tui/tui-layout.c
@@ -354,13 +354,14 @@ tui_default_win_viewport_height (enum tui_win_type type,
far, WORD is the word currently being completed. */

static VEC (char_ptr) *
-layout_completer (struct cmd_list_element *ignore,
+layout_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
static const char *layout_names [] =
{ "src", "asm", "split", "regs", "next", "prev", NULL };

- return complete_on_enum (layout_names, text, word);
+ return complete_on_enum (cdata, layout_names, text, word);
}

/* Function to initialize gdb commands, for tui window layout
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index a61fadb..756f598 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -669,7 +669,8 @@ tui_reg_command (char *args, int from_tty)
names. */

static VEC (char_ptr) *
-tui_reggroup_completer (struct cmd_list_element *ignore,
+tui_reggroup_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
VEC (char_ptr) *result = NULL;
@@ -677,7 +678,7 @@ tui_reggroup_completer (struct cmd_list_element *ignore,
size_t len = strlen (word);
const char **tmp;

- result = reggroup_completer (ignore, text, word);
+ result = reggroup_completer (cdata, ignore, text, word);

for (tmp = extra; *tmp != NULL; ++tmp)
{
diff --git a/gdb/tui/tui-win.c b/gdb/tui/tui-win.c
index 29ad279..8e7fbd1 100644
--- a/gdb/tui/tui-win.c
+++ b/gdb/tui/tui-win.c
@@ -361,6 +361,7 @@ tui_set_var_cmd (char *null_args, int from_tty, struct cmd_list_element *c)

static VEC (char_ptr) *
window_name_completer (int include_next_prev_p,
+ struct completer_data *cdata,
const char *text, const char *word)
{
VEC (const_char_ptr) *completion_name_vec = NULL;
@@ -399,7 +400,8 @@ window_name_completer (int include_next_prev_p,

VEC_safe_push (const_char_ptr, completion_name_vec, NULL);
matches_vec
- = complete_on_enum (VEC_address (const_char_ptr, completion_name_vec),
+ = complete_on_enum (cdata,
+ VEC_address (const_char_ptr, completion_name_vec),
text, word);

VEC_free (const_char_ptr, completion_name_vec);
@@ -411,10 +413,11 @@ window_name_completer (int include_next_prev_p,
entered so far, WORD is the word currently being completed. */

static VEC (char_ptr) *
-focus_completer (struct cmd_list_element *ignore,
+focus_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
- return window_name_completer (1, text, word);
+ return window_name_completer (1, cdata, text, word);
}

/* Complete possible window names for winheight command. TEXT is the
@@ -422,7 +425,8 @@ focus_completer (struct cmd_list_element *ignore,
completed. */

static VEC (char_ptr) *
-winheight_completer (struct cmd_list_element *ignore,
+winheight_completer (struct completer_data *cdata,
+ struct cmd_list_element *ignore,
const char *text, const char *word)
{
/* The first word is the window name. That we can complete. Subsequent
@@ -430,7 +434,7 @@ winheight_completer (struct cmd_list_element *ignore,
if (word != text)
return NULL;

- return window_name_completer (0, text, word);
+ return window_name_completer (0, cdata, text, word);
}

/* Function to initialize gdb commands, for tui window