This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 33/40] Make the linespec/location completer ignore data symbols
- From: Pedro Alves <palves at redhat dot com>
- To: Keith Seitz <keiths at redhat dot com>, gdb-patches at sourceware dot org
- Date: Wed, 8 Nov 2017 16:22:37 +0000
- Subject: Re: [PATCH 33/40] Make the linespec/location completer ignore data symbols
- Authentication-results: sourceware.org; auth=none
- References: <1496406158-12663-1-git-send-email-palves@redhat.com> <1496406158-12663-34-git-send-email-palves@redhat.com> <9f43d55f-44bc-f2c7-cbc9-a06d1666de5b@redhat.com>
On 08/09/2017 04:42 PM, Keith Seitz wrote:
> On 06/02/2017 05:22 AM, Pedro Alves wrote:
>>
>> diff --git a/gdb/symtab.c b/gdb/symtab.c
>> index bbc317d..52cf70a 100644
>> --- a/gdb/symtab.c
>> +++ b/gdb/symtab.c
>> @@ -5034,11 +5034,44 @@ completion_list_add_fields (completion_tracker &tracker,
>> }
>> }
>>
>> +/* See symtab.h. */
>> +
>> +bool
>> +symbol_is_function_or_method (symbol *sym)
>> +{
>> + switch (TYPE_CODE (SYMBOL_TYPE (sym)))
>> + {
>> + case TYPE_CODE_FUNC:
>> + case TYPE_CODE_METHOD:
>> + return true;
>> + default:
>> + return false;
>> + }
>> +}
>> +
>> +/* Return whether MSYMBOL is a function/method. */
>> +
>
> I think "See symtab.h." is more customary here?
Indeed, fixed.
>
>> +bool
>> +symbol_is_function_or_method (minimal_symbol *msymbol)
>> +{
>> + switch (MSYMBOL_TYPE (msymbol))
>> + {
>> + case mst_text:
>> + case mst_text_gnu_ifunc:
>> + case mst_solib_trampoline:
>> + case mst_file_text:
>> + return true;
>> + default:
>> + return false;
>> + }
>> +}
>> +
>> /* Add matching symbols from SYMTAB to the current completion list. */
>>
>> static void
>> add_symtab_completions (struct compunit_symtab *cust,
>> completion_tracker &tracker,
>> + complete_symbol_mode mode,
>> const lookup_name_info &lookup_name,
>> const char *text, const char *word,
>> enum type_code code)
>
> Otherwise, LGTM.
I pushed this one in too, even though I haven't pushed patches
#31 nor #32 yet. (Because I haven't yet addressed your reviews).
(I don't really recall why I originally ordered this one after.
There seems to be no good reason.)
Thanks,
Pedro Alves