diff options
Diffstat (limited to 'gdb/symtab.h')
-rw-r--r-- | gdb/symtab.h | 104 |
1 files changed, 43 insertions, 61 deletions
diff --git a/gdb/symtab.h b/gdb/symtab.h index e547d10..64028bf 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -145,7 +145,7 @@ private: std::string m_encoded_name; /* The decoded lookup name. This is formed by calling ada_decode - with both 'operators' and 'wide' set to false. */ + with 'translate' set to false. */ std::string m_decoded_name; /* Whether the user-provided lookup name was Ada encoded. If so, @@ -967,9 +967,9 @@ to_scripting_domain (domain_search_flags val) Throws an exception if VAL is not one of the allowable values. */ extern domain_search_flags from_scripting_domain (int val); -/* An address-class says where to find the value of a symbol. */ +/* A location class says where to find the value of a symbol. */ -enum address_class +enum location_class { /* Not used; catches errors. */ @@ -1078,14 +1078,14 @@ enum address_class LOC_FINAL_VALUE }; -/* The number of bits needed for values in enum address_class, with some +/* The number of bits needed for values in enum location_class, with some padding for reasonable growth, and room for run-time registered address classes. See symtab.c:MAX_SYMBOL_IMPLS. This is a #define so that we can have a assertion elsewhere to verify that we have reserved enough space for synthetic address classes. */ -#define SYMBOL_ACLASS_BITS 5 -static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_ACLASS_BITS)); +#define SYMBOL_LOC_CLASS_BITS 5 +static_assert (LOC_FINAL_VALUE <= (1 << SYMBOL_LOC_CLASS_BITS)); /* The methods needed to implement LOC_COMPUTED. These methods can use the symbol's .aux_value for additional per-symbol information. @@ -1202,7 +1202,7 @@ struct symbol_register_ops struct symbol_impl { - enum address_class aclass; + location_class loc_class; /* Used with LOC_COMPUTED. */ const struct symbol_computed_ops *ops_computed; @@ -1238,7 +1238,7 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol> symbol () /* Class-initialization of bitfields is only allowed in C++20. */ : m_domain (UNDEF_DOMAIN), - m_aclass_index (0), + m_loc_class_index (0), m_is_objfile_owned (1), m_is_argument (0), m_is_inlined (0), @@ -1262,14 +1262,14 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol> symbol (const symbol &) = default; symbol &operator= (const symbol &) = default; - void set_aclass_index (unsigned int aclass_index) + void set_loc_class_index (unsigned int loc_class_index) { - m_aclass_index = aclass_index; + m_loc_class_index = loc_class_index; } const symbol_impl &impl () const { - return symbol_impls[this->m_aclass_index]; + return symbol_impls[this->m_loc_class_index]; } const symbol_block_ops *block_ops () const @@ -1287,9 +1287,9 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol> return this->impl ().ops_register; } - address_class aclass () const + location_class loc_class () const { - return this->impl ().aclass; + return this->impl ().loc_class; } /* Return true if this symbol's domain matches FLAGS. */ @@ -1480,11 +1480,11 @@ struct symbol : public general_symbol_info, public allocate_on_obstack<symbol> ENUM_BITFIELD(domain_enum) m_domain : SYMBOL_DOMAIN_BITS; - /* Address class. This holds an index into the 'symbol_impls' - table. The actual enum address_class value is stored there, + /* Location class. This holds an index into the 'symbol_impls' + table. The actual location_class value is stored there, alongside any per-class ops vectors. */ - unsigned int m_aclass_index : SYMBOL_ACLASS_BITS; + unsigned int m_loc_class_index : SYMBOL_LOC_CLASS_BITS; /* If non-zero then symbol is objfile-owned, use owner.symtab. Otherwise symbol is arch-owned, use owner.arch. */ @@ -1575,13 +1575,13 @@ symbol::value_block () const return m_value.block; } -extern int register_symbol_computed_impl (enum address_class, +extern int register_symbol_computed_impl (location_class, const struct symbol_computed_ops *); -extern int register_symbol_block_impl (enum address_class aclass, +extern int register_symbol_block_impl (location_class loc_class, const struct symbol_block_ops *ops); -extern int register_symbol_register_impl (enum address_class, +extern int register_symbol_register_impl (location_class, const struct symbol_register_ops *); /* An instance of this type is used to represent a C++ template @@ -1830,21 +1830,23 @@ using symtab_range = next_range<symtab>; where "foo.c(cu)" and "bar.c(cu)" are struct compunit_symtab objects, and the files foo.c, etc. are struct symtab objects. */ -struct compunit_symtab +struct compunit_symtab : intrusive_list_node<compunit_symtab> { + compunit_symtab (struct objfile *objfile, const char *name); + ~compunit_symtab (); + + DISABLE_COPY_AND_ASSIGN (compunit_symtab); + struct objfile *objfile () const { return m_objfile; } - void set_objfile (struct objfile *objfile) - { - m_objfile = objfile; - } - symtab_range filetabs () const { - return symtab_range (m_filetabs); + next_iterator<symtab> begin (m_filetabs); + + return symtab_range (std::move (begin)); } void add_filetab (symtab *filetab) @@ -1957,15 +1959,6 @@ struct compunit_symtab /* Clear any cached source file names. */ void forget_cached_source_info (); - /* This is called when an objfile is being destroyed and will free - any resources used by this compunit_symtab. Normally a - destructor would be used instead, but at the moment - compunit_symtab objects are allocated on an obstack. */ - void finalize (); - - /* Unordered chain of all compunit symtabs of this objfile. */ - struct compunit_symtab *next; - /* Object file from which this symtab information was read. */ struct objfile *m_objfile; @@ -1978,30 +1971,30 @@ struct compunit_symtab source file (e.g., .c, .cc) is guaranteed to be first. Each symtab is a file, either the "main" source file (e.g., .c, .cc) or header (e.g., .h). */ - symtab *m_filetabs; + symtab *m_filetabs = nullptr; /* Last entry in FILETABS list. Subfiles are added to the end of the list so they accumulate in order, with the main source subfile living at the front. The main reason is so that the main source file symtab is at the head of the list, and the rest appear in order for debugging convenience. */ - symtab *m_last_filetab; + symtab *m_last_filetab = nullptr; /* Non-NULL string that identifies the format of the debugging information, such as "stabs", "dwarf 1", "dwarf 2", "coff", etc. This is mostly useful for automated testing of gdb but may also be information that is useful to the user. */ - const char *m_debugformat; + const char *m_debugformat = "unknown"; /* String of producer version information, or NULL if we don't know. */ - const char *m_producer; + const char *m_producer = nullptr; /* Directory in which it was compiled, or NULL if we don't know. */ - const char *m_dirname; + const char *m_dirname = nullptr; /* List of all symbol scope blocks for this symtab. It is shared among all symtabs in a given compilation unit. */ - struct blockvector *m_blockvector; + struct blockvector *m_blockvector = nullptr; /* Symtab has been compiled with both optimizations and debug info so that GDB may stop skipping prologues as variables locations are valid already @@ -2013,13 +2006,13 @@ struct compunit_symtab unsigned int m_epilogue_unwind_valid : 1; /* struct call_site entries for this compilation unit or NULL. */ - call_site_htab_t *m_call_site_htab; + std::unique_ptr<call_site_htab_t> m_call_site_htab; /* The macro table for this symtab. Like the blockvector, this is shared between different symtabs in a given compilation unit. It's debatable whether it *should* be shared among all the symtabs in the given compilation unit, but it currently is. */ - struct macro_table *m_macro_table; + struct macro_table *m_macro_table = nullptr; /* If non-NULL, then this points to a NULL-terminated vector of included compunits. When searching the static or global @@ -2028,17 +2021,15 @@ struct compunit_symtab list must be flattened -- the symbol reader is responsible for ensuring that this vector contains the transitive closure of all included compunits. */ - struct compunit_symtab **includes; + struct compunit_symtab **includes = nullptr; /* If this is an included compunit, this points to one includer of the table. This user is considered the canonical compunit containing this one. An included compunit may itself be included by another. */ - struct compunit_symtab *user; + struct compunit_symtab *user = nullptr; }; -using compunit_symtab_range = next_range<compunit_symtab>; - /* Return true if this symtab is the "main" symtab of its compunit_symtab. */ static inline bool @@ -2101,17 +2092,17 @@ struct field_of_this_result symbol was not found in 'this'. If non-NULL, then one of the other fields will be non-NULL as well. */ - struct type *type; + struct type *type = nullptr; /* If the symbol was found as an ordinary field of 'this', then this is non-NULL and points to the particular field. */ - struct field *field; + struct field *field = nullptr; /* If the symbol was found as a function field of 'this', then this is non-NULL and points to the particular field. */ - struct fn_fieldlist *fn_field; + struct fn_fieldlist *fn_field = nullptr; }; /* Find the definition for a specified symbol name NAME @@ -2482,8 +2473,7 @@ extern void collect_file_symbol_completion_matches symbol_name_match_type name_match_type, const char *, const char *, const char *); -extern completion_list - make_source_files_completion_list (const char *, const char *); +extern completion_list make_source_files_completion_list (const char *); /* Return whether SYM is a function/method, as opposed to a data symbol. */ @@ -2526,10 +2516,8 @@ extern symtab *find_line_symtab (symtab *sym_tab, int line, int *index); extern symtab_and_line find_function_start_sal (symbol *sym, bool funfirstline); -/* Same, but start with a function address/section instead of a - symbol. */ +/* Same, but start with a function address instead of a symbol. */ extern symtab_and_line find_function_start_sal (CORE_ADDR func_addr, - obj_section *section, bool funfirstline); extern void skip_prologue_sal (struct symtab_and_line *); @@ -2806,12 +2794,6 @@ bool compare_filenames_for_search (const char *filename, 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, - struct compunit_symtab *first, - struct compunit_symtab *after_last, - gdb::function_view<bool (symtab *)> callback); - /* Check in PSPACE for a symtab of a specific name; first in symtabs, then in psymtabs. *If* there is no '/' in the name, a match after a '/' in the symtab filename will also work. |