diff --git a/gdb/compile/compile-loc2c.c b/gdb/compile/compile-loc2c.c index df05c0140f0..2f5d85f0c3a 100644 --- a/gdb/compile/compile-loc2c.c +++ b/gdb/compile/compile-loc2c.c @@ -597,7 +597,7 @@ do_compile_dwarf_expr_to_c (int indent, string_file *stream, unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end, CORE_ADDR *initial, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { /* We keep a counter so that labels and other objects we create have @@ -1147,7 +1147,7 @@ compile_dwarf_expr_to_c (string_file *stream, const char *result_name, std::vector ®isters_used, unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { do_compile_dwarf_expr_to_c (2, stream, GCC_UINTPTR, result_name, sym, pc, @@ -1166,7 +1166,7 @@ compile_dwarf_bounds_to_c (string_file *stream, std::vector ®isters_used, unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { do_compile_dwarf_expr_to_c (2, stream, "unsigned long ", result_name, diff --git a/gdb/compile/compile.h b/gdb/compile/compile.h index 7d03d3c9bf1..e18b5bcc764 100644 --- a/gdb/compile/compile.h +++ b/gdb/compile/compile.h @@ -23,7 +23,7 @@ struct ui_file; struct gdbarch; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct dwarf2_per_objfile; struct symbol; struct dynamic_prop; @@ -215,7 +215,7 @@ extern void compile_dwarf_expr_to_c (string_file *stream, unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); /* Compile a DWARF bounds expression to C, suitable for use by the @@ -254,7 +254,7 @@ extern void compile_dwarf_bounds_to_c (string_file *stream, unsigned int addr_size, const gdb_byte *op_ptr, const gdb_byte *op_end, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); extern void compile_print_value (struct value *val, void *data_voidp); diff --git a/gdb/dwarf2/aranges.c b/gdb/dwarf2/aranges.c index b9903084416..1be67852b43 100644 --- a/gdb/dwarf2/aranges.c +++ b/gdb/dwarf2/aranges.c @@ -39,8 +39,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, struct gdbarch *gdbarch = objfile->arch (); dwarf2_per_bfd *per_bfd = per_objfile->per_bfd; - gdb::unordered_map - debug_info_offset_to_per_cu; + gdb::unordered_map debug_info_offset_to_per_cu; for (const auto &per_cu : per_bfd->all_units) { /* A TU will not need aranges, and skipping them here is an easy @@ -123,7 +122,7 @@ read_addrmap_from_aranges (dwarf2_per_objfile *per_objfile, sect_offset_str (sect_offset (debug_info_offset))); return false; } - dwarf2_per_cu_data *const per_cu = per_cu_it->second; + dwarf2_per_cu *const per_cu = per_cu_it->second; const uint8_t address_size = *addr++; if (address_size < 1 || address_size > 8) diff --git a/gdb/dwarf2/call-site.h b/gdb/dwarf2/call-site.h index 32cf673332b..ffade3bc153 100644 --- a/gdb/dwarf2/call-site.h +++ b/gdb/dwarf2/call-site.h @@ -28,7 +28,7 @@ #include "gdbsupport/unordered_set.h" struct dwarf2_locexpr_baton; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct dwarf2_per_objfile; /* struct call_site_parameter can be referenced in callees by several ways. */ @@ -164,7 +164,7 @@ struct call_site_parameter struct call_site { - call_site (unrelocated_addr pc, dwarf2_per_cu_data *per_cu, + call_site (unrelocated_addr pc, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) : per_cu (per_cu), per_objfile (per_objfile), m_unrelocated_pc (pc) {} @@ -209,7 +209,7 @@ struct call_site /* * CU of the function where the call is located. It gets used for DWARF blocks execution in the parameter array below. */ - dwarf2_per_cu_data *const per_cu = nullptr; + dwarf2_per_cu *const per_cu = nullptr; /* objfile of the function where the call is located. */ diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 6c6839cde9b..e609a2a9d46 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -273,9 +273,8 @@ cooked_index_entry::write_scope (struct obstack *storage, cooked_index_entry * cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag, cooked_index_flag flags, enum language lang, - const char *name, - cooked_index_entry_ref parent_entry, - dwarf2_per_cu_data *per_cu) + const char *name, cooked_index_entry_ref parent_entry, + dwarf2_per_cu *per_cu) { cooked_index_entry *result = create (die_offset, tag, flags, lang, name, parent_entry, per_cu); @@ -691,14 +690,14 @@ cooked_index::~cooked_index () /* See cooked-index.h. */ -dwarf2_per_cu_data * +dwarf2_per_cu * cooked_index::lookup (unrelocated_addr addr) { /* Ensure that the address maps are ready. */ wait (cooked_state::MAIN_AVAILABLE, true); for (const auto &shard : m_shards) { - dwarf2_per_cu_data *result = shard->lookup (addr); + dwarf2_per_cu *result = shard->lookup (addr); if (result != nullptr) return result; } @@ -857,14 +856,13 @@ cooked_index::dump (gdbarch *arch) if (obj != nullptr) { - const dwarf2_per_cu_data *per_cu - = static_cast (obj); - gdb_printf (" [%s] ((dwarf2_per_cu_data *) %p)\n", + const dwarf2_per_cu *per_cu + = static_cast (obj); + gdb_printf (" [%s] ((dwarf2_per_cu *) %p)\n", start_addr_str, per_cu); } else - gdb_printf (" [%s] ((dwarf2_per_cu_data *) 0)\n", - start_addr_str); + gdb_printf (" [%s] ((dwarf2_per_cu *) 0)\n", start_addr_str); return 0; }); diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index d642c132f8a..a1d174e0e88 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -40,7 +40,7 @@ #include #endif /* CXX_STD_THREAD */ -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct dwarf2_per_bfd; struct index_cache_store_context; struct cooked_index_entry; @@ -105,7 +105,7 @@ struct cooked_index_entry : public allocate_on_obstack cooked_index_flag flags_, enum language lang_, const char *name_, cooked_index_entry_ref parent_entry_, - dwarf2_per_cu_data *per_cu_) + dwarf2_per_cu *per_cu_) : name (name_), tag (tag_), flags (flags_), @@ -241,7 +241,7 @@ struct cooked_index_entry : public allocate_on_obstack /* The offset of this DIE. */ sect_offset die_offset; /* The CU from which this entry originates. */ - dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; private: @@ -279,7 +279,7 @@ public: cooked_index_flag flags, enum language lang, const char *name, cooked_index_entry_ref parent_entry, - dwarf2_per_cu_data *per_cu); + dwarf2_per_cu *per_cu); /* Install a new fixed addrmap from the given mutable addrmap. */ void install_addrmap (addrmap_mutable *map) @@ -317,13 +317,12 @@ private: /* Look up ADDR in the address map, and return either the corresponding CU, or nullptr if the address could not be found. */ - dwarf2_per_cu_data *lookup (unrelocated_addr addr) + dwarf2_per_cu *lookup (unrelocated_addr addr) { if (m_addrmap == nullptr) return nullptr; - return (static_cast - (m_addrmap->find ((CORE_ADDR) addr))); + return (static_cast (m_addrmap->find ((CORE_ADDR) addr))); } /* Create a new cooked_index_entry and register it with this object. @@ -334,7 +333,7 @@ private: enum language lang, const char *name, cooked_index_entry_ref parent_entry, - dwarf2_per_cu_data *per_cu) + dwarf2_per_cu *per_cu) { return new (&m_storage) cooked_index_entry (die_offset, tag, flags, lang, name, parent_entry, @@ -360,8 +359,7 @@ private: std::vector m_entries; /* If we found an entry with 'is_main' set, store it here. */ cooked_index_entry *m_main = nullptr; - /* The addrmap. This maps address ranges to dwarf2_per_cu_data - objects. */ + /* The addrmap. This maps address ranges to dwarf2_per_cu objects. */ addrmap_fixed *m_addrmap = nullptr; /* Storage for canonical names. */ std::vector> m_names; @@ -389,7 +387,7 @@ public: /* Return the DIE reader corresponding to PER_CU. If no such reader has been registered, return NULL. */ - cutu_reader *get_reader (dwarf2_per_cu_data *per_cu); + cutu_reader *get_reader (dwarf2_per_cu *per_cu); /* Preserve READER by storing it in the local hash table. */ cutu_reader *preserve (cutu_reader_up reader); @@ -400,7 +398,7 @@ public: cooked_index_flag flags, const char *name, cooked_index_entry_ref parent_entry, - dwarf2_per_cu_data *per_cu) + dwarf2_per_cu *per_cu) { return m_shard->add (die_offset, tag, flags, per_cu->lang (), name, parent_entry, per_cu); @@ -671,7 +669,7 @@ public: /* Look up ADDR in the address map, and return either the corresponding CU, or nullptr if the address could not be found. */ - dwarf2_per_cu_data *lookup (unrelocated_addr addr) override; + dwarf2_per_cu *lookup (unrelocated_addr addr) override; /* Return a new vector of all the addrmaps used by all the indexes held by this object. diff --git a/gdb/dwarf2/cu.c b/gdb/dwarf2/cu.c index 89f52825240..0e17b73dfc4 100644 --- a/gdb/dwarf2/cu.c +++ b/gdb/dwarf2/cu.c @@ -26,8 +26,7 @@ /* Initialize dwarf2_cu to read PER_CU, in the context of PER_OBJFILE. */ -dwarf2_cu::dwarf2_cu (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile) +dwarf2_cu::dwarf2_cu (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) : per_cu (per_cu), per_objfile (per_objfile), m_mark (false), @@ -141,7 +140,7 @@ dwarf2_cu::mark () m_mark = true; - for (dwarf2_per_cu_data *per_cu : m_dependencies) + for (dwarf2_per_cu *per_cu : m_dependencies) { /* cu->m_dependencies references may not yet have been ever read if QUIT aborts reading of the chain. As such diff --git a/gdb/dwarf2/cu.h b/gdb/dwarf2/cu.h index b97a5403dc8..6979b7cd276 100644 --- a/gdb/dwarf2/cu.h +++ b/gdb/dwarf2/cu.h @@ -50,8 +50,7 @@ struct delayed_method_info /* Internal state when decoding a particular compilation unit. */ struct dwarf2_cu { - explicit dwarf2_cu (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile); + explicit dwarf2_cu (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); DISABLE_COPY_AND_ASSIGN (dwarf2_cu); @@ -97,7 +96,7 @@ struct dwarf2_cu } /* Add a dependence relationship from this cu to REF_PER_CU. */ - void add_dependence (struct dwarf2_per_cu_data *ref_per_cu) + void add_dependence (dwarf2_per_cu *ref_per_cu) { m_dependencies.emplace (ref_per_cu); } /* The header of the compilation unit. */ @@ -268,10 +267,10 @@ private: symbols are being read. */ buildsym_compunit_up m_builder; - /* A set of pointers to dwarf2_per_cu_data objects for compilation - units referenced by this one. Only used during full symbol processing; - partial symbol tables do not have dependencies. */ - gdb::unordered_set m_dependencies; + /* A set of pointers to dwarf2_per_cu objects for compilation units referenced + by this one. Only used during full symbol processing; partial symbol + tables do not have dependencies. */ + gdb::unordered_set m_dependencies; public: /* The generic symbol table building routines have separate lists for @@ -290,7 +289,7 @@ public: auto_obstack comp_unit_obstack; /* Backlink to our per_cu entry. */ - struct dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; /* The dwarf2_per_objfile that owns this. */ dwarf2_per_objfile *per_objfile; diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c index 0977cfcab54..3a6165af86c 100644 --- a/gdb/dwarf2/expr.c +++ b/gdb/dwarf2/expr.c @@ -60,7 +60,7 @@ ensure_have_frame (const frame_info_ptr &frame, const char *op_name) /* Ensure that a PER_CU is defined and throw an exception otherwise. */ static void -ensure_have_per_cu (dwarf2_per_cu_data *per_cu, const char* op_name) +ensure_have_per_cu (dwarf2_per_cu *per_cu, const char *op_name) { if (per_cu == nullptr) throw_error (GENERIC_ERROR, @@ -96,7 +96,7 @@ struct piece_closure dwarf2_per_objfile *per_objfile = nullptr; /* The CU from which this closure's expression came. */ - dwarf2_per_cu_data *per_cu = nullptr; + dwarf2_per_cu *per_cu = nullptr; /* The pieces describing this variable. */ std::vector pieces; @@ -110,8 +110,7 @@ struct piece_closure PIECES. */ static piece_closure * -allocate_piece_closure (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, +allocate_piece_closure (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, std::vector &&pieces, const frame_info_ptr &frame) { @@ -670,8 +669,7 @@ static const struct lval_funcs pieced_value_funcs = { found at SECT_OFF. */ static value * -sect_variable_value (sect_offset sect_off, - dwarf2_per_cu_data *per_cu, +sect_variable_value (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { const char *var_name = nullptr; @@ -890,7 +888,7 @@ dwarf_expr_context::push_dwarf_reg_entry_value (call_site_parameter_kind kind, ensure_have_per_cu (this->m_per_cu, "DW_OP_entry_value"); ensure_have_frame (this->m_frame, "DW_OP_entry_value"); - dwarf2_per_cu_data *caller_per_cu; + dwarf2_per_cu *caller_per_cu; dwarf2_per_objfile *caller_per_objfile; frame_info_ptr caller_frame = get_prev_frame (this->m_frame); call_site_parameter *parameter @@ -1096,7 +1094,8 @@ dwarf_expr_context::fetch_result (struct type *type, struct type *subobj_type, value * dwarf_expr_context::evaluate (const gdb_byte *addr, size_t len, bool as_lval, - dwarf2_per_cu_data *per_cu, const frame_info_ptr &frame, + dwarf2_per_cu *per_cu, + const frame_info_ptr &frame, const struct property_addr_info *addr_info, struct type *type, struct type *subobj_type, LONGEST subobj_offset) diff --git a/gdb/dwarf2/expr.h b/gdb/dwarf2/expr.h index 1b1653e0768..4ef2e3ad17d 100644 --- a/gdb/dwarf2/expr.h +++ b/gdb/dwarf2/expr.h @@ -141,7 +141,7 @@ struct dwarf_expr_context The ADDR_INFO property can be specified to override the range of memory addresses with the passed in buffer. */ value *evaluate (const gdb_byte *addr, size_t len, bool as_lval, - dwarf2_per_cu_data *per_cu, const frame_info_ptr &frame, + dwarf2_per_cu *per_cu, const frame_info_ptr &frame, const struct property_addr_info *addr_info = nullptr, struct type *type = nullptr, struct type *subobj_type = nullptr, @@ -203,7 +203,7 @@ private: frame_info_ptr m_frame = nullptr; /* Compilation unit used for the evaluation. */ - dwarf2_per_cu_data *m_per_cu = nullptr; + dwarf2_per_cu *m_per_cu = nullptr; /* Property address info used for the evaluation. */ const struct property_addr_info *m_addr_info = nullptr; diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c index 67dc5344cee..c290dfb77b8 100644 --- a/gdb/dwarf2/frame.c +++ b/gdb/dwarf2/frame.c @@ -772,9 +772,8 @@ dwarf2_frame_find_quirks (struct dwarf2_frame_state *fs, int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc, - struct dwarf2_per_cu_data *data, - int *regnum_out, LONGEST *offset_out, - CORE_ADDR *text_offset_out, + dwarf2_per_cu *data, int *regnum_out, + LONGEST *offset_out, CORE_ADDR *text_offset_out, const gdb_byte **cfa_start_out, const gdb_byte **cfa_end_out) { diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h index 7ff31904da7..15d89eae7b9 100644 --- a/gdb/dwarf2/frame.h +++ b/gdb/dwarf2/frame.h @@ -24,7 +24,7 @@ struct gdbarch; class frame_info_ptr; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct agent_expr; struct axs_value; @@ -251,13 +251,12 @@ CORE_ADDR dwarf2_frame_cfa (const frame_info_ptr &this_frame); in other cases. These are only used when 0 is returned. */ extern int dwarf2_fetch_cfa_info (struct gdbarch *gdbarch, CORE_ADDR pc, - struct dwarf2_per_cu_data *data, - int *regnum_out, LONGEST *offset_out, + dwarf2_per_cu *data, int *regnum_out, + LONGEST *offset_out, CORE_ADDR *text_offset_out, const gdb_byte **cfa_start_out, const gdb_byte **cfa_end_out); - /* Allocate a new instance of the function unique data. The main purpose of this custom function data object is to allow caching the diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c index cba10f9588f..174eb220df6 100644 --- a/gdb/dwarf2/index-write.c +++ b/gdb/dwarf2/index-write.c @@ -562,8 +562,7 @@ write_hash_table (mapped_symtab *symtab, data_buf &output, data_buf &cpool) } } -using cu_index_map - = gdb::unordered_map; +using cu_index_map = gdb::unordered_map; /* Helper struct for building the address table. */ struct addrmap_index_data @@ -604,8 +603,7 @@ add_address_entry (data_buf &addr_vec, int addrmap_index_data::operator() (CORE_ADDR start_addr, const void *obj) { - const dwarf2_per_cu_data *per_cu - = static_cast (obj); + const dwarf2_per_cu *per_cu = static_cast (obj); if (previous_valid) add_address_entry (addr_vec, @@ -874,7 +872,7 @@ public: m_debugstrlookup.file_write (file_str); } - void add_cu (dwarf2_per_cu_data *per_cu, offset_type index) + void add_cu (dwarf2_per_cu *per_cu, offset_type index) { m_cu_index_htab.emplace (per_cu, index); } @@ -1306,10 +1304,9 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table, data_buf objfile_cu_list; data_buf dwz_cu_list; - /* While we're scanning CU's create a table that maps a dwarf2_per_cu_data - (which is what addrmap records) to its index (which is what is recorded - in the index file). This will later be needed to write the address - table. */ + /* While we're scanning CU's create a table that maps a dwarf2_per_cu (which + is what addrmap records) to its index (which is what is recorded in the + index file). This will later be needed to write the address table. */ cu_index_map cu_index_htab; cu_index_htab.reserve (per_bfd->all_units.size ()); @@ -1322,7 +1319,7 @@ write_gdbindex (dwarf2_per_bfd *per_bfd, cooked_index *table, int counter = 0; for (int i = 0; i < per_bfd->all_units.size (); ++i) { - dwarf2_per_cu_data *per_cu = per_bfd->all_units[i].get (); + dwarf2_per_cu *per_cu = per_bfd->all_units[i].get (); const auto insertpair = cu_index_htab.emplace (per_cu, counter); gdb_assert (insertpair.second); @@ -1405,7 +1402,7 @@ write_debug_names (dwarf2_per_bfd *per_bfd, cooked_index *table, int types_counter = 0; for (int i = 0; i < per_bfd->all_units.size (); ++i) { - dwarf2_per_cu_data *per_cu = per_bfd->all_units[i].get (); + dwarf2_per_cu *per_cu = per_bfd->all_units[i].get (); int &this_counter = per_cu->is_debug_types ? types_counter : counter; data_buf &this_list = per_cu->is_debug_types ? types_cu_list : cu_list; diff --git a/gdb/dwarf2/loc.c b/gdb/dwarf2/loc.c index 585b5de8c9d..398c2b1b352 100644 --- a/gdb/dwarf2/loc.c +++ b/gdb/dwarf2/loc.c @@ -49,7 +49,7 @@ static struct value *dwarf2_evaluate_loc_desc_full (struct type *type, const frame_info_ptr &frame, const gdb_byte *data, - size_t size, dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, + size_t size, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, struct type *subobj_type, LONGEST subobj_byte_offset, bool as_lval = true); /* Until these have formal names, we define these here. @@ -153,7 +153,7 @@ decode_debug_loc_addresses (const gdb_byte *loc_ptr, const gdb_byte *buf_end, The result indicates the kind of entry found. */ static enum debug_loc_kind -decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, +decode_debug_loclists_addresses (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const gdb_byte *loc_ptr, const gdb_byte *buf_end, @@ -288,7 +288,7 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, The result indicates the kind of entry found. */ static enum debug_loc_kind -decode_debug_loc_dwo_addresses (dwarf2_per_cu_data *per_cu, +decode_debug_loc_dwo_addresses (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const gdb_byte *loc_ptr, const gdb_byte *buf_end, @@ -1137,7 +1137,7 @@ struct call_site_parameter * dwarf_expr_reg_to_entry_parameter (const frame_info_ptr &initial_frame, call_site_parameter_kind kind, call_site_parameter_u kind_u, - dwarf2_per_cu_data **per_cu_return, + dwarf2_per_cu **per_cu_return, dwarf2_per_objfile **per_objfile_return) { CORE_ADDR func_addr, caller_pc; @@ -1259,7 +1259,7 @@ static struct value * dwarf_entry_parameter_to_value (struct call_site_parameter *parameter, CORE_ADDR deref_size, struct type *type, const frame_info_ptr &caller_frame, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { const gdb_byte *data_src; @@ -1343,7 +1343,7 @@ value_of_dwarf_reg_entry (struct type *type, const frame_info_ptr &frame, frame_info_ptr caller_frame = get_prev_frame (frame); struct value *outer_val, *target_val, *val; struct call_site_parameter *parameter; - dwarf2_per_cu_data *caller_per_cu; + dwarf2_per_cu *caller_per_cu; dwarf2_per_objfile *caller_per_objfile; parameter = dwarf_expr_reg_to_entry_parameter (frame, kind, kind_u, @@ -1416,7 +1416,7 @@ value_of_dwarf_block_entry (struct type *type, const frame_info_ptr &frame, static struct value * fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, struct type *type) { @@ -1449,7 +1449,7 @@ fetch_const_value_from_synthetic_pointer (sect_offset die, LONGEST byte_offset, struct value * indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const frame_info_ptr &frame, struct type *type, bool resolve_abstract_p) @@ -1493,7 +1493,7 @@ indirect_synthetic_pointer (sect_offset die, LONGEST byte_offset, static struct value * dwarf2_evaluate_loc_desc_full (struct type *type, const frame_info_ptr &frame, const gdb_byte *data, size_t size, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, struct type *subobj_type, LONGEST subobj_byte_offset, @@ -1558,7 +1558,7 @@ dwarf2_evaluate_loc_desc_full (struct type *type, const frame_info_ptr &frame, struct value * dwarf2_evaluate_loc_desc (struct type *type, const frame_info_ptr &frame, const gdb_byte *data, size_t size, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bool as_lval) { return dwarf2_evaluate_loc_desc_full (type, frame, data, size, per_cu, @@ -1589,7 +1589,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton, return 0; dwarf2_per_objfile *per_objfile = dlbaton->per_objfile; - dwarf2_per_cu_data *per_cu = dlbaton->per_cu; + dwarf2_per_cu *per_cu = dlbaton->per_cu; dwarf_expr_context ctx (per_objfile, per_cu->addr_size ()); value *result; @@ -1787,7 +1787,7 @@ dwarf2_compile_property_to_c (string_file *stream, const dwarf2_property_baton *baton = prop->baton (); const gdb_byte *data; size_t size; - dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; dwarf2_per_objfile *per_objfile; if (prop->kind () == PROP_LOCEXPR) @@ -1820,7 +1820,7 @@ dwarf2_compile_property_to_c (string_file *stream, static enum symbol_needs_kind dwarf2_get_symbol_read_needs (gdb::array_view expr, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bfd_endian byte_order, int addr_size, @@ -2371,8 +2371,7 @@ access_memory (struct gdbarch *arch, struct agent_expr *expr, ULONGEST nbits) static void dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc, unsigned int addr_size, const gdb_byte *op_ptr, - const gdb_byte *op_end, - dwarf2_per_cu_data *per_cu, + const gdb_byte *op_end, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { gdbarch *arch = expr->gdbarch; @@ -3134,7 +3133,7 @@ locexpr_regname (struct gdbarch *gdbarch, int dwarf_regnum) static const gdb_byte * locexpr_describe_location_piece (struct symbol *symbol, struct ui_file *stream, - CORE_ADDR addr, dwarf2_per_cu_data *per_cu, + CORE_ADDR addr, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const gdb_byte *data, const gdb_byte *end, unsigned int addr_size) @@ -3314,7 +3313,7 @@ disassemble_dwarf_expression (struct ui_file *stream, int offset_size, const gdb_byte *start, const gdb_byte *data, const gdb_byte *end, int indent, int all, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { while (data < end @@ -3720,7 +3719,7 @@ locexpr_describe_location_1 (struct symbol *symbol, CORE_ADDR addr, struct ui_file *stream, const gdb_byte *data, size_t size, unsigned int addr_size, - int offset_size, dwarf2_per_cu_data *per_cu, + int offset_size, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { const gdb_byte *end = data + size; diff --git a/gdb/dwarf2/loc.h b/gdb/dwarf2/loc.h index 78635682d94..5c7330e43a0 100644 --- a/gdb/dwarf2/loc.h +++ b/gdb/dwarf2/loc.h @@ -24,7 +24,7 @@ struct symbol_computed_ops; struct dwarf2_per_objfile; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct dwarf2_loclist_baton; struct agent_expr; struct axs_value; @@ -67,7 +67,7 @@ value *compute_var_value (const char *name); call_site_parameter *dwarf_expr_reg_to_entry_parameter (const frame_info_ptr &frame, call_site_parameter_kind kind, - call_site_parameter_u kind_u, dwarf2_per_cu_data **per_cu_return, + call_site_parameter_u kind_u, dwarf2_per_cu **per_cu_return, dwarf2_per_objfile **per_objfile_return); @@ -78,7 +78,7 @@ call_site_parameter *dwarf_expr_reg_to_entry_parameter value *dwarf2_evaluate_loc_desc (type *type, const frame_info_ptr &frame, const gdb_byte *data, size_t size, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bool as_lval = true); @@ -172,7 +172,7 @@ struct dwarf2_locexpr_baton /* The compilation unit containing the symbol whose location we're computing. */ - struct dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; }; struct dwarf2_loclist_baton @@ -192,7 +192,7 @@ struct dwarf2_loclist_baton /* The compilation unit containing the symbol whose location we're computing. */ - struct dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; /* Non-zero if the location list lives in .debug_loc.dwo. The format of entries in this section are different. */ @@ -293,7 +293,7 @@ extern void invalid_synthetic_pointer (); /* Fetch the value pointed to by a synthetic pointer. */ extern struct value *indirect_synthetic_pointer - (sect_offset die, LONGEST byte_offset, dwarf2_per_cu_data *per_cu, + (sect_offset die, LONGEST byte_offset, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const frame_info_ptr &frame, struct type *type, bool resolve_abstract_p = false); diff --git a/gdb/dwarf2/mapped-index.h b/gdb/dwarf2/mapped-index.h index 3117df260bc..15677ec71ab 100644 --- a/gdb/dwarf2/mapped-index.h +++ b/gdb/dwarf2/mapped-index.h @@ -65,7 +65,7 @@ struct dwarf_scanner_base /* Look up ADDR, and return either the corresponding CU, or nullptr if the address could not be found. */ - virtual dwarf2_per_cu_data *lookup (unrelocated_addr addr) + virtual dwarf2_per_cu *lookup (unrelocated_addr addr) { return nullptr; } }; diff --git a/gdb/dwarf2/read-debug-names.c b/gdb/dwarf2/read-debug-names.c index 924b570a5f4..34db3dbee79 100644 --- a/gdb/dwarf2/read-debug-names.c +++ b/gdb/dwarf2/read-debug-names.c @@ -174,7 +174,7 @@ mapped_debug_names_reader::scan_one_entry (const char *name, cooked_index_flag flags = 0; sect_offset die_offset {}; enum language lang = language_unknown; - dwarf2_per_cu_data *per_cu = nullptr; + dwarf2_per_cu *per_cu = nullptr; for (const auto &attr : indexval.attr_vec) { ULONGEST ull; diff --git a/gdb/dwarf2/read-gdb-index.c b/gdb/dwarf2/read-gdb-index.c index baa54938653..66d7209c1dd 100644 --- a/gdb/dwarf2/read-gdb-index.c +++ b/gdb/dwarf2/read-gdb-index.c @@ -129,7 +129,7 @@ struct mapped_gdb_index : public dwarf_scanner_base /* The shortcut table data. */ gdb::array_view shortcut_table; - /* An address map that maps from PC to dwarf2_per_cu_data. */ + /* An address map that maps from PC to dwarf2_per_cu. */ addrmap_fixed *index_addrmap = nullptr; /* Return the index into the constant pool of the name of the IDXth @@ -186,13 +186,13 @@ struct mapped_gdb_index : public dwarf_scanner_base return version >= 8; } - dwarf2_per_cu_data *lookup (unrelocated_addr addr) override + dwarf2_per_cu *lookup (unrelocated_addr addr) override { if (index_addrmap == nullptr) return nullptr; void *obj = index_addrmap->find (static_cast (addr)); - return static_cast (obj); + return static_cast (obj); } cooked_index *index_for_writing () override @@ -1113,7 +1113,8 @@ dw2_expand_marked_cus (dwarf2_per_objfile *per_objfile, offset_type idx, continue; } - dwarf2_per_cu_data *per_cu = per_objfile->per_bfd->get_cu (cu_index); + dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (cu_index); + if (!dw2_expand_symtabs_matching_one (per_cu, per_objfile, file_matcher, expansion_notify, lang_matcher)) return false; @@ -1141,8 +1142,7 @@ dwarf2_gdb_index::expand_symtabs_matching gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); if (lookup_name == nullptr) { - for (dwarf2_per_cu_data *per_cu - : all_units_range (per_objfile->per_bfd)) + for (dwarf2_per_cu *per_cu : all_units_range (per_objfile->per_bfd)) { QUIT; @@ -1324,7 +1324,7 @@ create_cus_from_gdb_index_list (dwarf2_per_bfd *per_bfd, ULONGEST length = extract_unsigned_integer (cu_list + 8, 8, BFD_ENDIAN_LITTLE); cu_list += 2 * 8; - dwarf2_per_cu_data_up per_cu + dwarf2_per_cu_up per_cu = create_cu_from_index_list (per_bfd, section, is_dwz, sect_off, length); per_bfd->all_units.push_back (std::move (per_cu)); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index b377b07cf7c..1203cbd0ab6 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -320,7 +320,7 @@ struct dwo_unit /* The section this CU/TU lives in, in the DWO file. */ struct dwarf2_section_info *section; - /* Same as dwarf2_per_cu_data:{sect_off,length} but in the DWO section. */ + /* Same as dwarf2_per_cu::{sect_off,length} but in the DWO section. */ sect_offset sect_off; unsigned int length; @@ -588,7 +588,7 @@ class cutu_reader : public die_reader_specs { public: - cutu_reader (dwarf2_per_cu_data *this_cu, + cutu_reader (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, const struct abbrev_table *abbrev_table, dwarf2_cu *existing_cu, @@ -596,7 +596,7 @@ public: enum language pretend_language, const abbrev_table_cache *cache = nullptr); - cutu_reader (dwarf2_per_cu_data *this_cu, + cutu_reader (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language, struct dwarf2_cu *parent_cu = nullptr, @@ -622,7 +622,7 @@ public: } private: - void init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu, + void init_tu_and_read_dwo_dies (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu, enum language pretend_language); @@ -630,7 +630,7 @@ private: void prepare_one_comp_unit (struct dwarf2_cu *cu, enum language pretend_language); - struct dwarf2_per_cu_data *m_this_cu; + dwarf2_per_cu *m_this_cu; dwarf2_cu_up m_new_cu; /* The ordinary abbreviation table. */ @@ -1026,7 +1026,7 @@ static struct type *get_DW_AT_signature_type (struct die_info *, const struct attribute *, struct dwarf2_cu *); -static void load_full_type_unit (dwarf2_per_cu_data *per_cu, +static void load_full_type_unit (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); static void read_signatured_type (signatured_type *sig_type, @@ -1056,14 +1056,14 @@ static const gdb_byte *skip_one_die (const struct die_reader_specs *reader, const struct abbrev_info *abbrev, bool do_skip_children = true); -static struct dwarf2_per_cu_data *dwarf2_find_containing_comp_unit +static dwarf2_per_cu *dwarf2_find_containing_comp_unit (sect_offset sect_off, unsigned int offset_in_dwz, dwarf2_per_bfd *per_bfd); static struct type *set_die_type (struct die_info *, struct type *, struct dwarf2_cu *, bool = false); -static void load_full_comp_unit (dwarf2_per_cu_data *per_cu, +static void load_full_comp_unit (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu, bool skip_partial, @@ -1076,12 +1076,12 @@ static void process_full_type_unit (dwarf2_cu *cu, enum language pretend_language); static struct type *get_die_type_at_offset (sect_offset, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); -static void queue_comp_unit (dwarf2_per_cu_data *per_cu, +static void queue_comp_unit (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language); @@ -1135,7 +1135,7 @@ dwarf2_queue_item::~dwarf2_queue_item () /* See dwarf2/read.h. */ void -dwarf2_per_cu_data_deleter::operator() (dwarf2_per_cu_data *data) +dwarf2_per_cu_deleter::operator() (dwarf2_per_cu *data) { if (data->is_debug_types) delete static_cast (data); @@ -1314,7 +1314,7 @@ private: /* See read.h. */ bool -dwarf2_per_objfile::symtab_set_p (const dwarf2_per_cu_data *per_cu) const +dwarf2_per_objfile::symtab_set_p (const dwarf2_per_cu *per_cu) const { if (per_cu->index < this->m_symtabs.size ()) return this->m_symtabs[per_cu->index] != nullptr; @@ -1324,7 +1324,7 @@ dwarf2_per_objfile::symtab_set_p (const dwarf2_per_cu_data *per_cu) const /* See read.h. */ compunit_symtab * -dwarf2_per_objfile::get_symtab (const dwarf2_per_cu_data *per_cu) const +dwarf2_per_objfile::get_symtab (const dwarf2_per_cu *per_cu) const { if (per_cu->index < this->m_symtabs.size ()) return this->m_symtabs[per_cu->index]; @@ -1334,7 +1334,7 @@ dwarf2_per_objfile::get_symtab (const dwarf2_per_cu_data *per_cu) const /* See read.h. */ void -dwarf2_per_objfile::set_symtab (const dwarf2_per_cu_data *per_cu, +dwarf2_per_objfile::set_symtab (const dwarf2_per_cu *per_cu, compunit_symtab *symtab) { if (per_cu->index >= this->m_symtabs.size ()) @@ -1738,7 +1738,7 @@ create_quick_file_names_table (unsigned int nr_initial_entries) You should call age_cached_comp_units after processing the CU. */ static dwarf2_cu * -load_cu (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, +load_cu (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial) { if (per_cu->is_debug_types) @@ -1759,7 +1759,7 @@ load_cu (dwarf2_per_cu_data *per_cu, dwarf2_per_objfile *per_objfile, /* Read in the symbols for PER_CU in the context of PER_OBJFILE. */ static void -dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu, +dw2_do_instantiate_symtab (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial) { { @@ -1800,8 +1800,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu, Returns the resulting symbol table. */ static struct compunit_symtab * -dw2_instantiate_symtab (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, +dw2_instantiate_symtab (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, bool skip_partial) { if (!per_objfile->symtab_set_p (per_cu)) @@ -1817,12 +1816,12 @@ dw2_instantiate_symtab (dwarf2_per_cu_data *per_cu, /* See read.h. */ -dwarf2_per_cu_data_up +dwarf2_per_cu_up dwarf2_per_bfd::allocate_per_cu (dwarf2_section_info *section, sect_offset sect_off, unsigned int length) { - dwarf2_per_cu_data_up result (new dwarf2_per_cu_data (this, section, - sect_off, length)); + dwarf2_per_cu_up result (new dwarf2_per_cu (this, section, sect_off, + length)); result->index = all_units.size (); return result; } @@ -1844,13 +1843,14 @@ dwarf2_per_bfd::allocate_signatured_type (dwarf2_section_info *section, /* See read.h. */ -dwarf2_per_cu_data_up +dwarf2_per_cu_up create_cu_from_index_list (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, int is_dwz, sect_offset sect_off, ULONGEST length) { - dwarf2_per_cu_data_up the_cu = per_bfd->allocate_per_cu (section, sect_off, length); + dwarf2_per_cu_up the_cu + = per_bfd->allocate_per_cu (section, sect_off, length); the_cu->is_dwz = is_dwz; return the_cu; } @@ -1862,9 +1862,8 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, struct die_info *comp_unit_die) { struct dwarf2_cu *cu = reader->cu; - struct dwarf2_per_cu_data *this_cu = cu->per_cu; + dwarf2_per_cu *this_cu = cu->per_cu; dwarf2_per_objfile *per_objfile = cu->per_objfile; - struct dwarf2_per_cu_data *lh_cu; struct attribute *attr; void **slot; struct quick_file_names *qfn; @@ -1877,7 +1876,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, if (comp_unit_die->tag == DW_TAG_partial_unit) return; - lh_cu = this_cu; + dwarf2_per_cu *lh_cu = this_cu; slot = NULL; line_header_up lh; @@ -1957,8 +1956,7 @@ dw2_get_file_names_reader (const struct die_reader_specs *reader, table for THIS_CU. */ static struct quick_file_names * -dw2_get_file_names (dwarf2_per_cu_data *this_cu, - dwarf2_per_objfile *per_objfile) +dw2_get_file_names (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile) { /* This should never be called for TUs. */ gdb_assert (! this_cu->is_debug_types); @@ -2004,8 +2002,7 @@ struct symtab * dwarf2_base_index_functions::find_last_source_symtab (struct objfile *objfile) { dwarf2_per_objfile *per_objfile = get_dwarf2_per_objfile (objfile); - dwarf2_per_cu_data *dwarf_cu - = per_objfile->per_bfd->all_units.back ().get (); + dwarf2_per_cu *dwarf_cu = per_objfile->per_bfd->all_units.back ().get (); compunit_symtab *cust = dw2_instantiate_symtab (dwarf_cu, per_objfile, false); if (cust == NULL) @@ -2017,7 +2014,7 @@ dwarf2_base_index_functions::find_last_source_symtab (struct objfile *objfile) /* See read.h. */ void -dwarf2_per_cu_data::free_cached_file_names () +dwarf2_per_cu::free_cached_file_names () { if (fnd != nullptr) fnd->forget_fullname (); @@ -2059,7 +2056,7 @@ dwarf2_base_index_functions::print_stats (struct objfile *objfile, for (int i = 0; i < total; ++i) { - dwarf2_per_cu_data *per_cu = per_objfile->per_bfd->get_cu (i); + dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (i); if (!per_objfile->symtab_set_p (per_cu)) ++count; @@ -2076,7 +2073,7 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile) for (int i = 0; i < total_units; ++i) { - dwarf2_per_cu_data *per_cu = per_objfile->per_bfd->get_cu (i); + dwarf2_per_cu *per_cu = per_objfile->per_bfd->get_cu (i); /* We don't want to directly expand a partial CU, because if we read it with the wrong language, then assertion failures can @@ -2091,7 +2088,7 @@ dwarf2_base_index_functions::expand_all_symtabs (struct objfile *objfile) bool dw2_expand_symtabs_matching_one - (dwarf2_per_cu_data *per_cu, + (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, expand_symtabs_file_matcher file_matcher, expand_symtabs_expansion_listener expansion_notify, @@ -2259,7 +2256,7 @@ dwarf2_base_index_functions::find_pc_sect_compunit_symtab return nullptr; CORE_ADDR baseaddr = objfile->text_section_offset (); - struct dwarf2_per_cu_data *data + dwarf2_per_cu *data = per_bfd->index_table->lookup ((unrelocated_addr) (pc - baseaddr)); if (data == nullptr) return nullptr; @@ -2305,8 +2302,7 @@ dwarf2_base_index_functions::map_symbol_filenames (objfile *objfile, } } - for (dwarf2_per_cu_data *per_cu - : all_units_range (per_objfile->per_bfd)) + for (dwarf2_per_cu *per_cu : all_units_range (per_objfile->per_bfd)) { /* We only need to look at symtabs not already expanded. */ if (per_cu->is_debug_types || per_objfile->symtab_set_p (per_cu)) @@ -2528,7 +2524,7 @@ dwarf2_find_base_address (struct die_info *die, struct dwarf2_cu *cu) THIS_CU. */ static struct dwarf2_section_info * -get_abbrev_section_for_cu (struct dwarf2_per_cu_data *this_cu) +get_abbrev_section_for_cu (dwarf2_per_cu *this_cu) { struct dwarf2_section_info *abbrev; dwarf2_per_bfd *per_bfd = this_cu->per_bfd; @@ -2923,7 +2919,7 @@ read_cutu_die_from_dwo (dwarf2_cu *cu, abbrev_table_up *result_dwo_abbrev_table) { dwarf2_per_objfile *per_objfile = cu->per_objfile; - dwarf2_per_cu_data *per_cu = cu->per_cu; + dwarf2_per_cu *per_cu = cu->per_cu; struct objfile *objfile = per_objfile->objfile; bfd *abfd; const gdb_byte *begin_info_ptr, *info_ptr; @@ -3089,7 +3085,7 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name) std::lock_guard guard (dwo_lock); #endif - dwarf2_per_cu_data *per_cu = cu->per_cu; + dwarf2_per_cu *per_cu = cu->per_cu; struct dwo_unit *dwo_unit; const char *comp_dir; @@ -3122,7 +3118,7 @@ lookup_dwo_unit (dwarf2_cu *cu, die_info *comp_unit_die, const char *dwo_name) Read a TU directly from a DWO file, bypassing the stub. */ void -cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu, +cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu, enum language pretend_language) @@ -3181,7 +3177,7 @@ cutu_reader::init_tu_and_read_dwo_dies (dwarf2_per_cu_data *this_cu, If EXISTING_CU is non-NULL, then use it. Otherwise, a new CU is allocated. */ -cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, +cutu_reader::cutu_reader (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, const struct abbrev_table *abbrev_table, dwarf2_cu *existing_cu, @@ -3418,7 +3414,7 @@ cutu_reader::keep () When parent_cu is passed, it is used to provide a default value for str_offsets_base and addr_base from the parent. */ -cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu, +cutu_reader::cutu_reader (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language, struct dwarf2_cu *parent_cu, @@ -3604,7 +3600,7 @@ cooked_index_storage::cooked_index_storage () } cutu_reader * -cooked_index_storage::get_reader (dwarf2_per_cu_data *per_cu) +cooked_index_storage::get_reader (dwarf2_per_cu *per_cu) { int index = per_cu->index; return (cutu_reader *) htab_find_with_hash (m_reader_hash.get (), @@ -3713,9 +3709,7 @@ parent_map_map::dump (dwarf2_per_bfd *per_bfd) const class cooked_indexer { public: - - cooked_indexer (cooked_index_storage *storage, - dwarf2_per_cu_data *per_cu, + cooked_indexer (cooked_index_storage *storage, dwarf2_per_cu *per_cu, enum language language) : m_index_storage (storage), m_per_cu (per_cu), @@ -3759,7 +3753,7 @@ private: /* Scan the attributes for a given DIE and update the out parameters. Returns a pointer to the byte after the DIE. */ - const gdb_byte *scan_attributes (dwarf2_per_cu_data *scanning_per_cu, + const gdb_byte *scan_attributes (dwarf2_per_cu *scanning_per_cu, cutu_reader *reader, const gdb_byte *watermark_ptr, const gdb_byte *info_ptr, @@ -3794,7 +3788,7 @@ private: asked to index one CU but to treat the results as if they come from some including CU; in this case the including CU would be recorded here. */ - dwarf2_per_cu_data *m_per_cu; + dwarf2_per_cu *m_per_cu; /* The language that we're assuming when reading. */ enum language m_language; @@ -3806,7 +3800,7 @@ private: Process compilation unit THIS_CU for a psymtab. */ static void -process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu, +process_psymtab_comp_unit (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, cooked_index_storage *storage) { @@ -3848,7 +3842,7 @@ build_type_psymtabs_reader (cutu_reader *reader, cooked_index_storage *storage) { struct dwarf2_cu *cu = reader->cu; - struct dwarf2_per_cu_data *per_cu = cu->per_cu; + dwarf2_per_cu *per_cu = cu->per_cu; struct die_info *type_unit_die = reader->comp_unit_die; gdb_assert (per_cu->is_debug_types); @@ -4107,7 +4101,7 @@ private: void done_reading (); /* An iterator for the comp units. */ - typedef std::vector::iterator unit_iterator; + using unit_iterator = std::vector::iterator; /* Process a batch of CUs. This may be called multiple times in separate threads. TASK_NUMBER indicates which task this is -- @@ -4134,7 +4128,8 @@ cooked_index_worker_debug_info::process_cus (size_t task_number, unit_iterator f cooked_index_storage thread_storage; for (auto inner = first; inner != end; ++inner) { - dwarf2_per_cu_data *per_cu = inner->get (); + dwarf2_per_cu *per_cu = inner->get (); + try { process_psymtab_comp_unit (per_cu, m_per_objfile, &thread_storage); @@ -4273,7 +4268,7 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile, while (info_ptr < section->buffer + section->size) { - dwarf2_per_cu_data_up this_cu; + dwarf2_per_cu_up this_cu; sect_offset sect_off = (sect_offset) (info_ptr - section->buffer); @@ -4324,7 +4319,7 @@ finalize_all_units (dwarf2_per_bfd *per_bfd) { size_t nr_tus = per_bfd->tu_stats.nr_tus; size_t nr_cus = per_bfd->all_units.size () - nr_tus; - gdb::array_view tmp = per_bfd->all_units; + gdb::array_view tmp = per_bfd->all_units; per_bfd->all_comp_units = tmp.slice (0, nr_cus); per_bfd->all_type_units = tmp.slice (nr_cus, nr_tus); } @@ -4605,8 +4600,7 @@ skip_one_die (const struct die_reader_specs *reader, const gdb_byte *info_ptr, /* Add PER_CU to the queue. */ static void -queue_comp_unit (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, +queue_comp_unit (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language) { per_cu->queued = 1; @@ -4641,8 +4635,7 @@ queue_comp_unit (dwarf2_per_cu_data *per_cu, that by calling `dwarf2_per_objfile::get_cu` instead. */ static bool -maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, - dwarf2_per_cu_data *per_cu, +maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, enum language pretend_language) { @@ -4707,7 +4700,7 @@ process_queue (dwarf2_per_objfile *per_objfile) while (!per_objfile->queue->empty ()) { dwarf2_queue_item &item = per_objfile->queue->front (); - dwarf2_per_cu_data *per_cu = item.per_cu; + dwarf2_per_cu *per_cu = item.per_cu; if (!per_objfile->symtab_set_p (per_cu)) { @@ -4782,7 +4775,7 @@ process_queue (dwarf2_per_objfile *per_objfile) rather than creating a new one. */ static void -load_full_comp_unit (dwarf2_per_cu_data *this_cu, +load_full_comp_unit (dwarf2_per_cu *this_cu, dwarf2_per_objfile *per_objfile, dwarf2_cu *existing_cu, bool skip_partial, @@ -5330,9 +5323,9 @@ void dwarf2_per_objfile::set_type_for_signatured_type static void recursively_compute_inclusions (std::vector *result, - gdb::unordered_set &all_children, + gdb::unordered_set &all_children, gdb::unordered_set &all_type_symtabs, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, struct compunit_symtab *immediate_parent) { @@ -5367,7 +5360,7 @@ recursively_compute_inclusions } } - for (dwarf2_per_cu_data *ptr : per_cu->imported_symtabs) + for (dwarf2_per_cu *ptr : per_cu->imported_symtabs) recursively_compute_inclusions (result, all_children, all_type_symtabs, ptr, per_objfile, cust); @@ -5377,7 +5370,7 @@ recursively_compute_inclusions PER_CU. */ static void -compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu, +compute_compunit_symtab_includes (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { gdb_assert (! per_cu->is_debug_types); @@ -5392,10 +5385,10 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu, if (cust == NULL) return; - gdb::unordered_set all_children; + gdb::unordered_set all_children; gdb::unordered_set all_type_symtabs; - for (dwarf2_per_cu_data *ptr : per_cu->imported_symtabs) + for (dwarf2_per_cu *ptr : per_cu->imported_symtabs) recursively_compute_inclusions (&result_symtabs, all_children, all_type_symtabs, ptr, per_objfile, cust); @@ -5417,7 +5410,7 @@ compute_compunit_symtab_includes (dwarf2_per_cu_data *per_cu, static void process_cu_includes (dwarf2_per_objfile *per_objfile) { - for (dwarf2_per_cu_data *iter : per_objfile->per_bfd->just_read_cus) + for (dwarf2_per_cu *iter : per_objfile->per_bfd->just_read_cus) { if (! iter->is_debug_types) compute_compunit_symtab_includes (iter, per_objfile); @@ -5627,7 +5620,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) sect_offset sect_off = attr->get_ref_die_offset (); bool is_dwz = (attr->form == DW_FORM_GNU_ref_alt || cu->per_cu->is_dwz); dwarf2_per_objfile *per_objfile = cu->per_objfile; - dwarf2_per_cu_data *per_cu + dwarf2_per_cu *per_cu = dwarf2_find_containing_comp_unit (sect_off, is_dwz, per_objfile->per_bfd); @@ -7067,7 +7060,7 @@ create_cus_hash_table (dwarf2_per_objfile *per_objfile, sect_offset sect_off = (sect_offset) (info_ptr - section.buffer); /* The length of the CU gets set by the cutu_reader just below. */ - dwarf2_per_cu_data per_cu (per_bfd, §ion, sect_off, 0); + dwarf2_per_cu per_cu (per_bfd, §ion, sect_off, 0); cutu_reader reader (&per_cu, per_objfile, language_minimal, cu, &dwo_file); @@ -15324,7 +15317,7 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader, && reader->cu->header.offset_in_cu_p (sect_off)) return reader; - dwarf2_per_cu_data *per_cu + dwarf2_per_cu *per_cu = dwarf2_find_containing_comp_unit (sect_off, is_dwz, per_objfile->per_bfd); @@ -15363,7 +15356,7 @@ cooked_indexer::ensure_cu_exists (cutu_reader *reader, } const gdb_byte * -cooked_indexer::scan_attributes (dwarf2_per_cu_data *scanning_per_cu, +cooked_indexer::scan_attributes (dwarf2_per_cu *scanning_per_cu, cutu_reader *reader, const gdb_byte *watermark_ptr, const gdb_byte *info_ptr, @@ -15929,7 +15922,7 @@ cooked_index_functions::find_compunit_symtab_by_address cooked_index *table = wait (objfile, true); CORE_ADDR baseaddr = objfile->data_section_offset (); - dwarf2_per_cu_data *per_cu + dwarf2_per_cu *per_cu = table->lookup ((unrelocated_addr) (address - baseaddr)); if (per_cu == nullptr) return nullptr; @@ -15958,8 +15951,7 @@ cooked_index_functions::expand_symtabs_matching gdb_assert (lookup_name != nullptr || symbol_matcher == nullptr); if (lookup_name == nullptr) { - for (dwarf2_per_cu_data *per_cu - : all_units_range (per_objfile->per_bfd)) + for (dwarf2_per_cu *per_cu : all_units_range (per_objfile->per_bfd)) { QUIT; @@ -16791,8 +16783,7 @@ read_addr_index_from_leb128 (struct dwarf2_cu *cu, const gdb_byte *info_ptr, /* See read.h. */ unrelocated_addr -dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, +dwarf2_read_addr_index (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, unsigned int addr_index) { struct dwarf2_cu *cu = per_objfile->get_cu (per_cu); @@ -18998,11 +18989,10 @@ lookup_die_type (struct die_info *die, const struct attribute *attr, if (attr->form == DW_FORM_GNU_ref_alt) { - struct dwarf2_per_cu_data *per_cu; sect_offset sect_off = attr->get_ref_die_offset (); + dwarf2_per_cu *per_cu + = dwarf2_find_containing_comp_unit (sect_off, 1, per_objfile->per_bfd); - per_cu = dwarf2_find_containing_comp_unit (sect_off, 1, - per_objfile->per_bfd); this_type = get_die_type_at_offset (sect_off, per_cu, per_objfile); } else if (attr->form_is_ref ()) @@ -19728,10 +19718,9 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, else if (offset_in_dwz != cu->per_cu->is_dwz || !cu->header.offset_in_cu_p (sect_off)) { - struct dwarf2_per_cu_data *per_cu; - - per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz, - per_objfile->per_bfd); + dwarf2_per_cu *per_cu + = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz, + per_objfile->per_bfd); dwarf_read_debug_printf_v ("target CU offset: %s, " "target CU DIEs loaded: %d", @@ -19803,8 +19792,7 @@ follow_die_ref (struct die_info *src_die, const struct attribute *attr, /* See read.h. */ struct dwarf2_locexpr_baton -dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, - dwarf2_per_cu_data *per_cu, +dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view get_frame_pc, bool resolve_abstract_p) @@ -19909,8 +19897,7 @@ dwarf2_fetch_die_loc_sect_off (sect_offset sect_off, /* See read.h. */ struct dwarf2_locexpr_baton -dwarf2_fetch_die_loc_cu_off (cu_offset offset_in_cu, - dwarf2_per_cu_data *per_cu, +dwarf2_fetch_die_loc_cu_off (cu_offset offset_in_cu, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view get_frame_pc) { @@ -19943,7 +19930,7 @@ write_constant_as_bytes (struct obstack *obstack, const gdb_byte * dwarf2_fetch_constant_bytes (sect_offset sect_off, - dwarf2_per_cu_data *per_cu, + dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, obstack *obstack, LONGEST *len) @@ -20082,8 +20069,7 @@ dwarf2_fetch_constant_bytes (sect_offset sect_off, /* See read.h. */ struct type * -dwarf2_fetch_die_type_sect_off (sect_offset sect_off, - dwarf2_per_cu_data *per_cu, +dwarf2_fetch_die_type_sect_off (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, const char **var_name) { @@ -20108,8 +20094,7 @@ dwarf2_fetch_die_type_sect_off (sect_offset sect_off, /* See read.h. */ struct type * -dwarf2_get_die_type (cu_offset die_offset, - dwarf2_per_cu_data *per_cu, +dwarf2_get_die_type (cu_offset die_offset, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { sect_offset die_offset_sect = per_cu->sect_off + to_underlying (die_offset); @@ -20304,8 +20289,7 @@ get_DW_AT_signature_type (struct die_info *die, const struct attribute *attr, /* Load the DIEs associated with type unit PER_CU into memory. */ static void -load_full_type_unit (dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile) +load_full_type_unit (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { struct signatured_type *sig_type; @@ -20791,7 +20775,7 @@ dwarf2_symbol_mark_computed (const struct attribute *attr, struct symbol *sym, /* See read.h. */ const comp_unit_head * -dwarf2_per_cu_data::get_header () const +dwarf2_per_cu::get_header () const { if (!m_header_read_in) { @@ -20810,7 +20794,7 @@ dwarf2_per_cu_data::get_header () const /* See read.h. */ int -dwarf2_per_cu_data::addr_size () const +dwarf2_per_cu::addr_size () const { return this->get_header ()->addr_size; } @@ -20818,7 +20802,7 @@ dwarf2_per_cu_data::addr_size () const /* See read.h. */ int -dwarf2_per_cu_data::offset_size () const +dwarf2_per_cu::offset_size () const { return this->get_header ()->offset_size; } @@ -20826,7 +20810,7 @@ dwarf2_per_cu_data::offset_size () const /* See read.h. */ int -dwarf2_per_cu_data::ref_addr_size () const +dwarf2_per_cu::ref_addr_size () const { const comp_unit_head *header = this->get_header (); @@ -20839,8 +20823,7 @@ dwarf2_per_cu_data::ref_addr_size () const /* See read.h. */ void -dwarf2_per_cu_data::set_lang (enum language lang, - dwarf_source_language dw_lang) +dwarf2_per_cu::set_lang (enum language lang, dwarf_source_language dw_lang) { if (unit_type () == DW_UT_partial) return; @@ -20861,7 +20844,7 @@ dwarf2_per_cu_data::set_lang (enum language lang, /* See read.h. */ void -dwarf2_per_cu_data::ensure_lang (dwarf2_per_objfile *per_objfile) +dwarf2_per_cu::ensure_lang (dwarf2_per_objfile *per_objfile) { if (lang (false) != language_unknown) return; @@ -20881,7 +20864,7 @@ static int dwarf2_find_containing_comp_unit (sect_offset sect_off, unsigned int offset_in_dwz, - const std::vector &all_units) + const std::vector &all_units) { int low, high; @@ -20889,10 +20872,9 @@ dwarf2_find_containing_comp_unit high = all_units.size () - 1; while (high > low) { - struct dwarf2_per_cu_data *mid_cu; int mid = low + (high - low) / 2; + dwarf2_per_cu *mid_cu = all_units[mid].get (); - mid_cu = all_units[mid].get (); if (mid_cu->is_dwz > offset_in_dwz || (mid_cu->is_dwz == offset_in_dwz && mid_cu->sect_off + mid_cu->length () > sect_off)) @@ -20907,14 +20889,14 @@ dwarf2_find_containing_comp_unit /* Locate the .debug_info compilation unit from CU's objfile which contains the DIE at OFFSET. Raises an error on failure. */ -static struct dwarf2_per_cu_data * +static dwarf2_per_cu * dwarf2_find_containing_comp_unit (sect_offset sect_off, unsigned int offset_in_dwz, dwarf2_per_bfd *per_bfd) { int low = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz, per_bfd->all_units); - dwarf2_per_cu_data *this_cu = per_bfd->all_units[low].get (); + dwarf2_per_cu *this_cu = per_bfd->all_units[low].get (); if (this_cu->is_dwz != offset_in_dwz || this_cu->sect_off > sect_off) { @@ -20955,28 +20937,27 @@ run_test () auto per_bfd = reinterpret_cast (&dummy_per_bfd); auto section = reinterpret_cast (&dummy_section); - return dwarf2_per_cu_data_up (new dwarf2_per_cu_data (per_bfd, section, - sect_off, length)); + return dwarf2_per_cu_up (new dwarf2_per_cu (per_bfd, section, sect_off, + length)); }; /* Units in the main file. */ - dwarf2_per_cu_data_up one = create_dummy_per_cu (sect_offset (0), 5); - dwarf2_per_cu_data *one_ptr = one.get (); - dwarf2_per_cu_data_up two - = create_dummy_per_cu (sect_offset (one->length ()), 7); - dwarf2_per_cu_data *two_ptr = two.get (); + dwarf2_per_cu_up one = create_dummy_per_cu (sect_offset (0), 5); + dwarf2_per_cu *one_ptr = one.get (); + dwarf2_per_cu_up two = create_dummy_per_cu (sect_offset (one->length ()), 7); + dwarf2_per_cu *two_ptr = two.get (); /* Units in the supplementary (dwz) file. */ - dwarf2_per_cu_data_up three = create_dummy_per_cu (sect_offset (0), 5); - dwarf2_per_cu_data *three_ptr = three.get (); - dwarf2_per_cu_data_up four + dwarf2_per_cu_up three = create_dummy_per_cu (sect_offset (0), 5); + dwarf2_per_cu *three_ptr = three.get (); + dwarf2_per_cu_up four = create_dummy_per_cu (sect_offset (three->length ()), 7); - dwarf2_per_cu_data *four_ptr = four.get (); + dwarf2_per_cu *four_ptr = four.get (); three->is_dwz = 1; four->is_dwz = 1; - std::vector units; + std::vector units; units.push_back (std::move (one)); units.push_back (std::move (two)); units.push_back (std::move (three)); @@ -21087,7 +21068,7 @@ cutu_reader::prepare_one_comp_unit (struct dwarf2_cu *cu, /* See read.h. */ dwarf2_cu * -dwarf2_per_objfile::get_cu (dwarf2_per_cu_data *per_cu) +dwarf2_per_objfile::get_cu (dwarf2_per_cu *per_cu) { auto it = m_dwarf2_cus.find (per_cu); if (it == m_dwarf2_cus.end ()) @@ -21099,8 +21080,7 @@ dwarf2_per_objfile::get_cu (dwarf2_per_cu_data *per_cu) /* See read.h. */ void -dwarf2_per_objfile::set_cu (dwarf2_per_cu_data *per_cu, - dwarf2_cu_up cu) +dwarf2_per_objfile::set_cu (dwarf2_per_cu *per_cu, dwarf2_cu_up cu) { gdb_assert (this->get_cu (per_cu) == nullptr); @@ -21155,7 +21135,7 @@ dwarf2_per_objfile::age_comp_units () /* See read.h. */ void -dwarf2_per_objfile::remove_cu (dwarf2_per_cu_data *per_cu) +dwarf2_per_objfile::remove_cu (dwarf2_per_cu *per_cu) { auto it = m_dwarf2_cus.find (per_cu); if (it == m_dwarf2_cus.end ()) @@ -21261,8 +21241,7 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu, or return NULL if the die does not have a saved type. */ static struct type * -get_die_type_at_offset (sect_offset sect_off, - dwarf2_per_cu_data *per_cu, +get_die_type_at_offset (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile) { auto it = per_objfile->die_type_hash.find ({per_cu, sect_off}); diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h index fcb7d403d9f..ccc8f4f8e8c 100644 --- a/gdb/dwarf2/read.h +++ b/gdb/dwarf2/read.h @@ -49,7 +49,7 @@ struct tu_stats struct dwarf2_cu; struct dwarf2_debug_sections; struct dwarf2_per_bfd; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct mapped_index; struct mapped_debug_names; struct signatured_type; @@ -59,7 +59,7 @@ struct type_unit_group; for. */ struct dwarf2_queue_item { - dwarf2_queue_item (dwarf2_per_cu_data *cu, dwarf2_per_objfile *per_objfile, + dwarf2_queue_item (dwarf2_per_cu *cu, dwarf2_per_objfile *per_objfile, enum language lang) : per_cu (cu), per_objfile (per_objfile), @@ -71,35 +71,33 @@ struct dwarf2_queue_item DISABLE_COPY_AND_ASSIGN (dwarf2_queue_item); - dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; dwarf2_per_objfile *per_objfile; enum language pretend_language; }; -/* A deleter for dwarf2_per_cu_data that knows to downcast to - signatured_type as appropriate. This approach lets us avoid a - virtual destructor, which saves a bit of space. */ +/* A deleter for dwarf2_per_cu that knows to downcast to signatured_type as + appropriate. This approach lets us avoid a virtual destructor, which saves + a bit of space. */ -struct dwarf2_per_cu_data_deleter +struct dwarf2_per_cu_deleter { - void operator() (dwarf2_per_cu_data *data); + void operator() (dwarf2_per_cu *data); }; -/* A specialization of unique_ptr for dwarf2_per_cu_data and - subclasses. */ -using dwarf2_per_cu_data_up - = std::unique_ptr; +/* A specialization of unique_ptr for dwarf2_per_cu and subclasses. */ +using dwarf2_per_cu_up = std::unique_ptr; /* Persistent data held for a compilation unit, even when not processing it. We put a pointer to this structure in the psymtab. */ -struct dwarf2_per_cu_data +struct dwarf2_per_cu { /* LENGTH is the length of the unit. If the value is 0, it means it is not known, and may be set later using the set_length method. */ - dwarf2_per_cu_data (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section, - sect_offset sect_off, unsigned int length) + dwarf2_per_cu (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section, + sect_offset sect_off, unsigned int length) : sect_off (sect_off), m_length (length), is_debug_types (false), @@ -134,7 +132,7 @@ private: public: /* Non-zero if this CU is from .debug_types. - Struct dwarf2_per_cu_data is contained in struct signatured_type iff + Struct dwarf2_per_cu is contained in struct signatured_type iff this is non-zero. */ unsigned int is_debug_types : 1; @@ -222,7 +220,7 @@ public: /* DWARF header of this CU. Note that dwarf2_cu reads its own version of the header, which may differ from this one, since it may pass rcuh_kind::TYPE - to read_comp_unit_head, whereas for dwarf2_per_cu_data we always pass + to read_comp_unit_head, whereas for dwarf2_per_cu we always pass rcuh_kind::COMPILE. Don't access this field directly, use the get_header method instead. It @@ -255,7 +253,7 @@ public: to. Concurrently with this change gdb was modified to emit version 8 indices so we only pay a price for gold generated indices. http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */ - std::vector imported_symtabs; + std::vector imported_symtabs; /* Get the header of this per_cu, reading it if necessary. */ const comp_unit_head *get_header () const; @@ -374,11 +372,12 @@ public: /* Entry in the signatured_types hash table. */ -struct signatured_type : public dwarf2_per_cu_data +struct signatured_type : public dwarf2_per_cu { signatured_type (dwarf2_per_bfd *per_bfd, dwarf2_section_info *section, - sect_offset sect_off, unsigned int length, ULONGEST signature) - : dwarf2_per_cu_data (per_bfd, section, sect_off, length), + sect_offset sect_off, unsigned int length, + ULONGEST signature) + : dwarf2_per_cu (per_bfd, section, sect_off, length), signature (signature) { this->is_debug_types = true; @@ -473,13 +472,13 @@ struct dwarf2_per_bfd { return bfd_get_filename (this->obfd); } /* Return the CU given its index. */ - dwarf2_per_cu_data *get_cu (int index) const + dwarf2_per_cu *get_cu (int index) const { return this->all_units[index].get (); } /* Return the CU given its index in the CU table in the index. */ - dwarf2_per_cu_data *get_index_cu (int index) const + dwarf2_per_cu *get_index_cu (int index) const { if (this->all_comp_units_index_cus.empty ()) return get_cu (index); @@ -487,17 +486,16 @@ struct dwarf2_per_bfd return this->all_comp_units_index_cus[index]; } - dwarf2_per_cu_data *get_index_tu (int index) const + dwarf2_per_cu *get_index_tu (int index) const { return this->all_comp_units_index_tus[index]; } - /* A convenience function to allocate a dwarf2_per_cu_data. The - returned object has its "index" field set properly. The object - is allocated on the dwarf2_per_bfd obstack. */ - dwarf2_per_cu_data_up allocate_per_cu (dwarf2_section_info *section, - sect_offset sect_off, - unsigned int length); + /* A convenience function to allocate a dwarf2_per_cu. The returned object + has its "index" field set properly. The object is allocated on the + dwarf2_per_bfd obstack. */ + dwarf2_per_cu_up allocate_per_cu (dwarf2_section_info *section, + sect_offset sect_off, unsigned int length); /* A convenience function to allocate a signatured_type. The returned object has its "index" field set properly. The object @@ -554,15 +552,15 @@ public: /* Table of all the compilation units. This is used to locate the target compilation unit of a particular reference. */ - std::vector all_units; + std::vector all_units; /* The all_units vector contains both CUs and TUs. Provide views on the vector that are limited to either the CU part or the TU part. */ - gdb::array_view all_comp_units; - gdb::array_view all_type_units; + gdb::array_view all_comp_units; + gdb::array_view all_type_units; - std::vector all_comp_units_index_cus; - std::vector all_comp_units_index_tus; + std::vector all_comp_units_index_cus; + std::vector all_comp_units_index_tus; /* Table of struct type_unit_group objects. The hash key is the DW_AT_stmt_list value. */ @@ -609,7 +607,7 @@ public: htab_up quick_file_names_table; /* The CUs we recently read. */ - std::vector just_read_cus; + std::vector just_read_cus; /* If we loaded the index from an external file, this contains the resources associated to the open file, memory mapping, etc. */ @@ -647,7 +645,7 @@ public: return *this; } - dwarf2_per_cu_data *operator* () const + dwarf2_per_cu *operator* () const { return m_per_bfd->get_cu (m_index); } @@ -723,7 +721,7 @@ using type_unit_group_unshareable_up struct per_cu_and_offset { - dwarf2_per_cu_data *per_cu; + dwarf2_per_cu *per_cu; sect_offset offset; bool operator== (const per_cu_and_offset &other) const noexcept @@ -736,7 +734,7 @@ struct per_cu_and_offset_hash { std::uint64_t operator() (const per_cu_and_offset &key) const noexcept { - return (std::hash () (key.per_cu) + return (std::hash () (key.per_cu) + std::hash () (key.offset)); } }; @@ -769,13 +767,13 @@ struct dwarf2_per_objfile /* Return true if the symtab corresponding to PER_CU has been set, false otherwise. */ - bool symtab_set_p (const dwarf2_per_cu_data *per_cu) const; + bool symtab_set_p (const dwarf2_per_cu *per_cu) const; /* Return the compunit_symtab associated to PER_CU, if it has been created. */ - compunit_symtab *get_symtab (const dwarf2_per_cu_data *per_cu) const; + compunit_symtab *get_symtab (const dwarf2_per_cu *per_cu) const; /* Set the compunit_symtab associated to PER_CU. */ - void set_symtab (const dwarf2_per_cu_data *per_cu, compunit_symtab *symtab); + void set_symtab (const dwarf2_per_cu *per_cu, compunit_symtab *symtab); /* Get the type_unit_group_unshareable corresponding to TU_GROUP. If one does not exist, create it. */ @@ -788,13 +786,13 @@ struct dwarf2_per_objfile struct type *type); /* Get the dwarf2_cu matching PER_CU for this objfile. */ - dwarf2_cu *get_cu (dwarf2_per_cu_data *per_cu); + dwarf2_cu *get_cu (dwarf2_per_cu *per_cu); /* Set the dwarf2_cu matching PER_CU for this objfile. */ - void set_cu (dwarf2_per_cu_data *per_cu, dwarf2_cu_up cu); + void set_cu (dwarf2_per_cu *per_cu, dwarf2_cu_up cu); /* Remove/free the dwarf2_cu matching PER_CU for this objfile. */ - void remove_cu (dwarf2_per_cu_data *per_cu); + void remove_cu (dwarf2_per_cu *per_cu); /* Free all cached compilation units. */ void remove_all_cus (); @@ -825,7 +823,7 @@ struct dwarf2_per_objfile or the type may come from a DWO file. Furthermore, while it's more logical to use per_cu->section+offset, with Fission the section with the data is in the DWO file but we don't know that section at the point we need it. - We have to use something in dwarf2_per_cu_data (or the pointer to it) + We have to use something in dwarf2_per_cu (or the pointer to it) because we can enter the lookup routine, get_die_type_at_offset, from outside this file, and thus won't necessarily have PER_CU->cu. Fortunately, PER_CU is stable for the life of the objfile. */ @@ -842,9 +840,9 @@ struct dwarf2_per_objfile std::optional> queue; private: - /* Hold the corresponding compunit_symtab for each CU or TU. This - is indexed by dwarf2_per_cu_data::index. A NULL value means - that the CU/TU has not been expanded yet. */ + /* Hold the corresponding compunit_symtab for each CU or TU. This is indexed + by dwarf2_per_cu::index. A NULL value means that the CU/TU has not been + expanded yet. */ std::vector m_symtabs; /* Map from a type unit group to the corresponding unshared @@ -855,9 +853,9 @@ private: /* Map from signatured types to the corresponding struct type. */ gdb::unordered_map m_type_map; - /* Map from the objfile-independent dwarf2_per_cu_data instances to the + /* Map from the objfile-independent dwarf2_per_cu instances to the corresponding objfile-dependent dwarf2_cu instances. */ - gdb::unordered_map m_dwarf2_cus; + gdb::unordered_map m_dwarf2_cus; }; /* Converts DWARF language names to GDB language names. */ @@ -871,8 +869,7 @@ dwarf2_per_objfile *get_dwarf2_per_objfile (struct objfile *objfile); /* Return the type of the DIE at DIE_OFFSET in the CU named by PER_CU. */ -struct type *dwarf2_get_die_type (cu_offset die_offset, - dwarf2_per_cu_data *per_cu, +struct type *dwarf2_get_die_type (cu_offset die_offset, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile); /* Given an index in .debug_addr, fetch the value. @@ -880,7 +877,7 @@ struct type *dwarf2_get_die_type (cu_offset die_offset, long after the debug information has been read, and thus per_cu->cu may no longer exist. */ -unrelocated_addr dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu, +unrelocated_addr dwarf2_read_addr_index (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, unsigned int addr_index); @@ -890,7 +887,7 @@ unrelocated_addr dwarf2_read_addr_index (dwarf2_per_cu_data *per_cu, PER_CU->DWARF2_PER_OBJFILE->OBJFILE. */ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off - (sect_offset sect_off, dwarf2_per_cu_data *per_cu, + (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view get_frame_pc, bool resolve_abstract_p = false); @@ -899,7 +896,7 @@ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_sect_off offset. */ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off - (cu_offset offset_in_cu, dwarf2_per_cu_data *per_cu, + (cu_offset offset_in_cu, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, gdb::function_view get_frame_pc); @@ -909,7 +906,7 @@ struct dwarf2_locexpr_baton dwarf2_fetch_die_loc_cu_off does not have a DW_AT_const_value, return NULL. */ extern const gdb_byte *dwarf2_fetch_constant_bytes - (sect_offset sect_off, dwarf2_per_cu_data *per_cu, + (sect_offset sect_off, dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, obstack *obstack, LONGEST *len); @@ -918,10 +915,10 @@ extern const gdb_byte *dwarf2_fetch_constant_bytes the DIE in question is a variable declaration (definitions are excluded), then *VAR_NAME is set to the variable's name. */ -struct type *dwarf2_fetch_die_type_sect_off - (sect_offset sect_off, dwarf2_per_cu_data *per_cu, - dwarf2_per_objfile *per_objfile, - const char **var_name = nullptr); +type *dwarf2_fetch_die_type_sect_off (sect_offset sect_off, + dwarf2_per_cu *per_cu, + dwarf2_per_objfile *per_objfile, + const char **var_name = nullptr); /* When non-zero, dump line number entries as they are read in. */ extern unsigned int dwarf_line_debug; @@ -983,7 +980,7 @@ struct dwarf2_base_index_functions : public quick_symbol_functions EXPANSION_NOTIFY on it. */ extern bool dw2_expand_symtabs_matching_one - (dwarf2_per_cu_data *per_cu, + (dwarf2_per_cu *per_cu, dwarf2_per_objfile *per_objfile, expand_symtabs_file_matcher file_matcher, expand_symtabs_expansion_listener expansion_notify, @@ -1002,10 +999,10 @@ extern void dw_expand_symtabs_matching_file_matcher extern const char *read_indirect_string_at_offset (dwarf2_per_objfile *per_objfile, LONGEST str_offset); -/* Return a new dwarf2_per_cu_data allocated on the per-bfd - obstack, and constructed with the specified field values. */ +/* Return a new dwarf2_per_cu allocated on the per-bfd obstack, and constructed + with the specified field values. */ -extern dwarf2_per_cu_data_up create_cu_from_index_list +extern dwarf2_per_cu_up create_cu_from_index_list (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, int is_dwz, sect_offset sect_off, ULONGEST length); diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index 8b00fec59a1..0cc97aea330 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -56,7 +56,7 @@ struct field; struct block; struct value_print_options; struct language_defn; -struct dwarf2_per_cu_data; +struct dwarf2_per_cu; struct dwarf2_per_objfile; struct dwarf2_property_baton;