This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add autocompletion for convenience vars in print and set
- From: Tom Tromey <tromey at redhat dot com>
- To: Daniel Gutson <daniel dot gutson at tallertechnologies dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Tue, 20 May 2014 10:36:40 -0600
- Subject: Re: [PATCH] Add autocompletion for convenience vars in print and set
- Authentication-results: sourceware.org; auth=none
- References: <CAF5HaEUYNe60EPby2Mxbgxy68unMpoxYr8BnQAQNUV_z04wVsw at mail dot gmail dot com>
>>>>> "Daniel" == Daniel Gutson <daniel.gutson@tallertechnologies.com> writes:
Daniel> I could not find any testsuite where to add tests for this; if
Daniel> there are, please let me know.
See testsuite/gdb.base/completion.exp
Daniel> exp : VARIABLE
Daniel> {
Daniel> - write_dollar_variable (pstate, $1);
Daniel> + if (!parse_completion)
Daniel> + write_dollar_variable (pstate, $1);
Daniel> }
I think this isn't correct. I think it won't work if you try to
complete on a field name where the "LHS" has a convenience variable.
That is something like:
set $var = (struct x *) malloc (...)
complete print $var.somethin
Instead I think you need a new production, like "exp : VARIABLE COMPLETE".
Daniel> + if (p != NULL && *p == '$')
Daniel> + return complete_internalvar (p + 1);
I'm not sure this is correct either, but offhand I don't know.
Should it not look at "word"?
Daniel> + VEC (char_ptr) * ret = current_language->la_make_symbol_completion_list (
Daniel> + text, word,
Daniel> + TYPE_CODE_UNDEF);
No space before "ret".
The line breaks look odd, I would break before the "=" and not after the "(".
thanks,
Tom