On 13-03-2020 14:59, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> [gdb] Use partial symbol table to find language for main > > Tom> When language is set to auto, part of loading an executable is to update the > Tom> language accordingly. This is implemented by set_initial_language. > > ... > > Tom> +/* Psymtab version of lookup_symbol_language. See its definition in > Tom> + the definition of quick_symbol_functions in symfile.h. */ > Tom> + > Tom> +enum language > Tom> +psym_lookup_symbol_language (struct objfile *objfile, > Tom> + block_enum block_index, > Tom> + const char *name, > Tom> + domain_enum domain, > Tom> + bool *symbol_found_p) > > This should be static. > Ack, done. > Tom> diff --git a/gdb/psymtab.h b/gdb/psymtab.h > Tom> index 040b973927..a8a5d344b0 100644 > Tom> --- a/gdb/psymtab.h > Tom> +++ b/gdb/psymtab.h > Tom> @@ -151,4 +151,9 @@ extern const struct quick_symbol_functions dwarf2_debug_names_functions; > Tom> extern psymtab_storage::partial_symtab_range require_partial_symbols > Tom> (struct objfile *objfile, bool verbose); > > Tom> +enum language psym_lookup_symbol_language (struct objfile *objfile, > Tom> + block_enum block_index, > Tom> + const char *name, > Tom> + domain_enum domain, > Tom> + bool *symbol_found_p); > > ... and not declared here. > done. > Tom> + /* Check to see if the symbol is defined in a "partial" symbol table > Tom> + of OBJFILE. BLOCK_INDEX should be either GLOBAL_BLOCK or STATIC_BLOCK, > Tom> + depending on whether we want to search global symbols or static > Tom> + symbols. NAME is the name of the symbol to look for. DOMAIN > Tom> + indicates what sort of symbol to search for. > Tom> + > Tom> + If found, sets *symbol_found_p to true and returns the symbol language. > Tom> + defined, or NULL if no such symbol table exists. */ > Tom> + enum language (*lookup_symbol_language) (struct objfile *objfile, > Tom> + block_enum block_index, > > Does this really need the block index? It seems to me that main will > normally be global. Also, the code seems to only ever use the global > scope. > It doesn't need to, no. I've hard-coded GLOBAL_BLOCK and added global_ to the function names. > Tom> +/* Find the language for partial symbol with NAME. */ > Tom> + > Tom> +enum language > Tom> +find_quick_symbol_language (block_enum block_index, const char *name, > Tom> + const domain_enum domain) > > This can be static. > Done. > Tom> diff --git a/gdb/symtab.h b/gdb/symtab.h > Tom> index 5fa067b5f4..da8d3011ea 100644 > Tom> --- a/gdb/symtab.h > Tom> +++ b/gdb/symtab.h > Tom> @@ -2349,4 +2349,8 @@ private: > Tom> std::vector m_minimal_symbols; > Tom> }; > > Tom> +enum language > Tom> +find_quick_symbol_language (block_enum block_index, const char *name, > Tom> + const domain_enum domain); > > No need to declare here. Done. OK for trunk? Thanks, - Tom