X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fsymtab.h;h=1f0fc62a657dbc7a042bef905d8af5ac99be13e0;hb=ececd218c5254902db3301d700546f6702112c85;hp=57ed2c0948e464d0f17acb07add7f5384e931fed;hpb=1d94a5a36a614cf7ebe259d7660f4fa725f38ee2;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/symtab.h b/gdb/symtab.h index 57ed2c0948..1f0fc62a65 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -23,13 +23,13 @@ #include #include #include -#include "gdb_vecs.h" +#include "gdbsupport/gdb_vecs.h" #include "gdbtypes.h" #include "gdb_regex.h" -#include "common/enum-flags.h" -#include "common/function-view.h" -#include "common/gdb_optional.h" -#include "common/next-iterator.h" +#include "gdbsupport/enum-flags.h" +#include "gdbsupport/function-view.h" +#include "gdbsupport/gdb_optional.h" +#include "gdbsupport/next-iterator.h" #include "completer.h" /* Opaque declarations. */ @@ -497,7 +497,7 @@ extern void symbol_set_language (struct general_symbol_info *symbol, symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, \ (objfile)->per_bfd) extern void symbol_set_names (struct general_symbol_info *symbol, - const char *linkage_name, int len, int copy_name, + const char *linkage_name, int len, bool copy_name, struct objfile_per_bfd_storage *per_bfd); /* Now come lots of name accessor macros. Short version as to when to @@ -544,7 +544,7 @@ extern const char *symbol_demangled_name #define SYMBOL_PRINT_NAME(symbol) \ (demangle ? SYMBOL_NATURAL_NAME (symbol) : SYMBOL_LINKAGE_NAME (symbol)) -extern int demangle; +extern bool demangle; /* Macro that returns the name to be used when sorting and searching symbols. In C++, we search for the demangled form of a name, @@ -641,16 +641,8 @@ gdb_static_assert (nr_minsym_types <= (1 << MINSYM_TYPE_BITS)); between names and addresses, and vice versa. They are also sometimes used to figure out what full symbol table entries need to be read in. */ -struct minimal_symbol +struct minimal_symbol : public general_symbol_info { - - /* The general symbol info required for all types of symbols. - - The SYMBOL_VALUE_ADDRESS contains the address that this symbol - corresponds to. */ - - struct general_symbol_info mginfo; - /* Size of this symbol. dbx_end_psymtab in dbxread.c uses this information to calculate the end of the partial symtab based on the address of the last symbol plus the size of the last symbol. */ @@ -686,6 +678,14 @@ struct minimal_symbol the `next' pointer for the demangled hash table. */ struct minimal_symbol *demangled_hash_next; + + /* True if this symbol is of some data type. */ + + bool data_p () const; + + /* True if MSYMBOL is of some text type. */ + + bool text_p () const; }; #define MSYMBOL_TARGET_FLAG_1(msymbol) (msymbol)->target_flag_1 @@ -700,43 +700,38 @@ struct minimal_symbol #define MSYMBOL_HAS_SIZE(msymbol) ((msymbol)->has_size + 0) #define MSYMBOL_TYPE(msymbol) (msymbol)->type -#define MSYMBOL_VALUE(symbol) (symbol)->mginfo.value.ivalue +#define MSYMBOL_VALUE(symbol) (symbol)->value.ivalue /* The unrelocated address of the minimal symbol. */ -#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->mginfo.value.address + 0) +#define MSYMBOL_VALUE_RAW_ADDRESS(symbol) ((symbol)->value.address + 0) /* The relocated address of the minimal symbol, using the section offsets from OBJFILE. */ #define MSYMBOL_VALUE_ADDRESS(objfile, symbol) \ - ((symbol)->mginfo.value.address \ - + ANOFFSET ((objfile)->section_offsets, ((symbol)->mginfo.section))) + ((symbol)->value.address \ + + ANOFFSET ((objfile)->section_offsets, ((symbol)->section))) /* For a bound minsym, we can easily compute the address directly. */ #define BMSYMBOL_VALUE_ADDRESS(symbol) \ MSYMBOL_VALUE_ADDRESS ((symbol).objfile, (symbol).minsym) #define SET_MSYMBOL_VALUE_ADDRESS(symbol, new_value) \ - ((symbol)->mginfo.value.address = (new_value)) -#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->mginfo.value.bytes -#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->mginfo.value.block -#define MSYMBOL_VALUE_CHAIN(symbol) (symbol)->mginfo.value.chain -#define MSYMBOL_LANGUAGE(symbol) (symbol)->mginfo.language -#define MSYMBOL_SECTION(symbol) (symbol)->mginfo.section + ((symbol)->value.address = (new_value)) +#define MSYMBOL_VALUE_BYTES(symbol) (symbol)->value.bytes +#define MSYMBOL_BLOCK_VALUE(symbol) (symbol)->value.block +#define MSYMBOL_VALUE_CHAIN(symbol) (symbol)->value.chain +#define MSYMBOL_LANGUAGE(symbol) (symbol)->language +#define MSYMBOL_SECTION(symbol) (symbol)->section #define MSYMBOL_OBJ_SECTION(objfile, symbol) \ - (((symbol)->mginfo.section >= 0) \ - ? (&(((objfile)->sections)[(symbol)->mginfo.section])) \ + (((symbol)->section >= 0) \ + ? (&(((objfile)->sections)[(symbol)->section])) \ : NULL) #define MSYMBOL_NATURAL_NAME(symbol) \ - (symbol_natural_name (&(symbol)->mginfo)) -#define MSYMBOL_LINKAGE_NAME(symbol) (symbol)->mginfo.name + (symbol_natural_name (symbol)) +#define MSYMBOL_LINKAGE_NAME(symbol) (symbol)->name #define MSYMBOL_PRINT_NAME(symbol) \ (demangle ? MSYMBOL_NATURAL_NAME (symbol) : MSYMBOL_LINKAGE_NAME (symbol)) #define MSYMBOL_DEMANGLED_NAME(symbol) \ - (symbol_demangled_name (&(symbol)->mginfo)) -#define MSYMBOL_SET_LANGUAGE(symbol,language,obstack) \ - (symbol_set_language (&(symbol)->mginfo, (language), (obstack))) + (symbol_demangled_name (symbol)) #define MSYMBOL_SEARCH_NAME(symbol) \ - (symbol_search_name (&(symbol)->mginfo)) -#define MSYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile) \ - symbol_set_names (&(symbol)->mginfo, linkage_name, len, copy_name, \ - (objfile)->per_bfd) + (symbol_search_name (symbol)) #include "minsyms.h" @@ -1164,10 +1159,6 @@ struct block_symbol extern const struct symbol_impl *symbol_impls; -/* For convenience. All fields are NULL. This means "there is no - symbol". */ -extern const struct block_symbol null_block_symbol; - /* Note: There is no accessor macro for symbol.owner because it is "private". */ @@ -1330,16 +1321,6 @@ struct symtab const char *filename; - /* Total number of lines found in source file. */ - - int nlines; - - /* line_charpos[N] is the position of the (N-1)th line of the - source file. "position" means something we can lseek() to; it - is not guaranteed to be useful any other way. */ - - int *line_charpos; - /* Language of this source file. */ enum language language; @@ -1537,9 +1518,9 @@ extern const char multiple_symbols_cancel[]; const char *multiple_symbols_select_mode (void); -int symbol_matches_domain (enum language symbol_language, - domain_enum symbol_domain, - domain_enum domain); +bool symbol_matches_domain (enum language symbol_language, + domain_enum symbol_domain, + domain_enum domain); /* lookup a symbol table by source file name. */ @@ -1708,8 +1689,8 @@ extern struct symbol *find_symbol_at_address (CORE_ADDR); nullptr is used as a return value for *BLOCK if no block is found. This function either succeeds or fails (not halfway succeeds). If it succeeds, it sets *NAME, *ADDRESS, and *ENDADDR to real - information and returns 1. If it fails, it sets *NAME, *ADDRESS - and *ENDADDR to zero and returns 0. + information and returns true. If it fails, it sets *NAME, *ADDRESS + and *ENDADDR to zero and returns false. If the function in question occupies non-contiguous ranges, *ADDRESS and *ENDADDR are (subject to the conditions noted above) set @@ -1735,9 +1716,9 @@ extern struct symbol *find_symbol_at_address (CORE_ADDR); containing the entry pc should instead call find_function_entry_range_from_pc. */ -extern int find_pc_partial_function (CORE_ADDR pc, const char **name, - CORE_ADDR *address, CORE_ADDR *endaddr, - const struct block **block = nullptr); +extern bool find_pc_partial_function (CORE_ADDR pc, const char **name, + CORE_ADDR *address, CORE_ADDR *endaddr, + const struct block **block = nullptr); /* Like find_pc_partial_function, above, but *ADDRESS and *ENDADDR are set to start and end addresses of the range containing the entry pc. @@ -1783,7 +1764,7 @@ extern struct compunit_symtab *find_pc_compunit_symtab (CORE_ADDR); extern struct compunit_symtab * find_pc_sect_compunit_symtab (CORE_ADDR, struct obj_section *); -extern int find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *); +extern bool find_pc_line_pc_range (CORE_ADDR, CORE_ADDR *, CORE_ADDR *); extern void reread_symbols (void); @@ -1805,7 +1786,7 @@ extern struct type *basic_lookup_transparent_type (const char *); #define GCC2_COMPILED_FLAG_SYMBOL "gcc2_compiled." #endif -extern int in_gnu_ifunc_stub (CORE_ADDR pc); +extern bool in_gnu_ifunc_stub (CORE_ADDR pc); /* Functions for resolving STT_GNU_IFUNC symbols which are implemented only for ELF symbol files. */ @@ -1816,7 +1797,7 @@ struct gnu_ifunc_fns CORE_ADDR (*gnu_ifunc_resolve_addr) (struct gdbarch *gdbarch, CORE_ADDR pc); /* See elf_gnu_ifunc_resolve_name for its real implementation. */ - int (*gnu_ifunc_resolve_name) (const char *function_name, + bool (*gnu_ifunc_resolve_name) (const char *function_name, CORE_ADDR *function_address_p); /* See elf_gnu_ifunc_resolver_stop for its real implementation. */ @@ -1880,10 +1861,10 @@ extern struct symtab *find_pc_line_symtab (CORE_ADDR); /* Given a symtab and line number, return the pc there. */ -extern int find_line_pc (struct symtab *, int, CORE_ADDR *); +extern bool find_line_pc (struct symtab *, int, CORE_ADDR *); -extern int find_line_pc_range (struct symtab_and_line, CORE_ADDR *, - CORE_ADDR *); +extern bool find_line_pc_range (struct symtab_and_line, CORE_ADDR *, + CORE_ADDR *); extern void resolve_sal_pc (struct symtab_and_line *); @@ -1955,9 +1936,9 @@ completion_skip_symbol (complete_symbol_mode mode, Symbol *sym) /* symtab.c */ -int matching_obj_sections (struct obj_section *, struct obj_section *); +bool matching_obj_sections (struct obj_section *, struct obj_section *); -extern struct symtab *find_line_symtab (struct symtab *, int, int *, int *); +extern struct symtab *find_line_symtab (struct symtab *, int, int *, bool *); /* Given a function symbol SYM, find the symtab and line for the start of the function. If FUNFIRSTLINE is true, we want the first line @@ -2046,30 +2027,31 @@ extern std::vector search_symbols (const char *, enum search_domain, const char *, int, - const char **); + const char **, + bool); extern bool treg_matches_sym_type_name (const compiled_regex &treg, const struct symbol *sym); -/* The name of the ``main'' function. - FIXME: cagney/2001-03-20: Can't make main_name() const since some - of the calling code currently assumes that the string isn't - const. */ -extern /*const */ char *main_name (void); +/* The name of the ``main'' function. */ +extern const char *main_name (); extern enum language main_language (void); -/* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global blocks. +/* Lookup symbol NAME from DOMAIN in MAIN_OBJFILE's global or static blocks, + as specified by BLOCK_INDEX. This searches MAIN_OBJFILE as well as any associated separate debug info objfiles of MAIN_OBJFILE. + BLOCK_INDEX can be GLOBAL_BLOCK or STATIC_BLOCK. Upon success fixes up the symbol's section if necessary. */ extern struct block_symbol lookup_global_symbol_from_objfile (struct objfile *main_objfile, + enum block_enum block_index, const char *name, const domain_enum domain); /* Return 1 if the supplied producer string matches the ARM RealView compiler (armcc). */ -int producer_is_realview (const char *producer); +bool producer_is_realview (const char *producer); void fixup_section (struct general_symbol_info *ginfo, CORE_ADDR addr, struct objfile *objfile); @@ -2082,13 +2064,13 @@ extern unsigned int symtab_create_debug; extern unsigned int symbol_lookup_debug; -extern int basenames_may_differ; +extern bool basenames_may_differ; -int compare_filenames_for_search (const char *filename, - const char *search_name); +bool compare_filenames_for_search (const char *filename, + const char *search_name); -int compare_glob_filenames_for_search (const char *filename, - const char *search_name); +bool compare_glob_filenames_for_search (const char *filename, + const char *search_name); bool iterate_over_some_symtabs (const char *name, const char *real_path, @@ -2110,11 +2092,30 @@ std::vector find_pcs_for_symtab_line typedef bool (symbol_found_callback_ftype) (struct block_symbol *bsym); -void iterate_over_symbols (const struct block *block, +/* Iterate over the symbols named NAME, matching DOMAIN, in BLOCK. + + For each symbol that matches, CALLBACK is called. The symbol is + passed to the callback. + + If CALLBACK returns false, the iteration ends and this function + returns false. Otherwise, the search continues, and the function + eventually returns true. */ + +bool iterate_over_symbols (const struct block *block, const lookup_name_info &name, const domain_enum domain, gdb::function_view callback); +/* Like iterate_over_symbols, but if all calls to CALLBACK return + true, then calls CALLBACK one additional time with a block_symbol + that has a valid block but a NULL symbol. */ + +bool iterate_over_symbols_terminated + (const struct block *block, + const lookup_name_info &name, + const domain_enum domain, + gdb::function_view callback); + /* Storage type used by demangle_for_lookup. demangle_for_lookup either returns a const char * pointer that points to either of the fields of this type, or a pointer to the input NAME. This is done