This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC][gdb] Use partial symbol table to find language for main
- From: Tom Tromey <tom at tromey dot com>
- To: Tom de Vries <tdevries at suse dot de>
- Cc: gdb-patches at sourceware dot org
- Date: Tue, 03 Mar 2020 08:48:42 -0700
- Subject: Re: [RFC][gdb] Use partial symbol table to find language for main
- References: <20200301231752.GA6202@delia>
>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:
Tom> Ideally, we'd like to get the language of the symbol without triggering
Tom> expansion into a full symtab, and get the speedup without having to set the
Tom> language manually.
This seems like a good idea.
Tom> +extern enum language
Tom> +find_psym_language (block_enum block_index, const char *name,
Tom> + const domain_enum domain);
FYI we don't normally line break after the type for declarations, only
definitions.
Tom> /* The languages above didn't identify the name of the main procedure.
Tom> Fallback to "main". */
Tom> +
Tom> + /* Try to find language for main in psymtabs. */
Tom> + enum language lang = find_psym_language (GLOBAL_BLOCK, "main", VAR_DOMAIN);
Generic code shouldn't call directly into the psymtab code. While most
debug readers create psymtabs, they aren't required to. For example,
the DWARF index code bypasses psymtabs entirely -- but this call might
cause the DWARF reader to create psymtabs in this case.
Instead the way to do this is add a new function pointer to
struct quick_symbol_functions, then implement it in the various debug
readers.
Tom