diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2018-04-07 13:53:40 -0400 |
---|---|---|
committer | Simon Marchi <simon.marchi@polymtl.ca> | 2018-04-07 13:53:41 -0400 |
commit | ff4c9fec8413fa4e0b11ef092a86669305894a7a (patch) | |
tree | eb4a8261fb5c6afc98f83287a0bf54882ca22b46 /gdb/dwarf2read.h | |
parent | 5ca3fcb669bc655e2e79866be086e8ac564e472b (diff) | |
download | binutils-ff4c9fec8413fa4e0b11ef092a86669305894a7a.zip binutils-ff4c9fec8413fa4e0b11ef092a86669305894a7a.tar.gz binutils-ff4c9fec8413fa4e0b11ef092a86669305894a7a.tar.bz2 |
Replace dw2_get_cu/dw2_get_cutu with methods of dwarf2_per_objfile
Those two functions look like good candidates to become methods of
dwarf2_per_objfile. I did that, and added get_tu as well. When
replacing usages of dw2_get_cutu, I changed some instances to get_cutu
and others to get_cu, when appropriate (when we know we want a CU and
not a TU).
gdb/ChangeLog:
* dwarf2read.h (struct signatured_type): Forward declare.
(struct dwarf2_per_objfile) <get_cutu, get_cu, get_tu>:
New methods.
* dwarf2read.c (dwarf2_per_objfile::get_cutu): Rename from...
(dw2_get_cutu): ...this.
(dwarf2_per_objfile::get_cu): Rename from...
(dw2_get_cu): ...this.
(dwarf2_per_objfile::get_tu): New.
(create_addrmap_from_index): Adjust.
(create_addrmap_from_aranges): Adjust.
(dw2_find_last_source_symtab): Adjust.
(dw2_map_symtabs_matching_filename): Adjust.
(dw2_symtab_iter_next): Adjust.
(dw2_print_stats): Adjust.
(dw2_expand_all_symtabs): Adjust.
(dw2_expand_symtabs_with_fullname): Adjust.
(dw2_expand_marked_cus): Adjust.
(dw_expand_symtabs_matching_file_matcher): Adjust.
(dw2_map_symbol_filenames): Adjust.
(dw2_debug_names_iterator::next): Adjust.
(dwarf2_initialize_objfile): Adjust.
(set_partial_user): Adjust.
(dwarf2_build_psymtabs_hard): Adjust.
Diffstat (limited to 'gdb/dwarf2read.h')
-rw-r--r-- | gdb/dwarf2read.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gdb/dwarf2read.h b/gdb/dwarf2read.h index 46a1052..24b5ff4 100644 --- a/gdb/dwarf2read.h +++ b/gdb/dwarf2read.h @@ -89,6 +89,7 @@ struct tu_stats struct dwarf2_debug_sections; struct mapped_index; struct mapped_debug_names; +struct signatured_type; /* Collection of data recorded per objfile. This hangs off of dwarf2_objfile_data_key. */ @@ -105,6 +106,30 @@ struct dwarf2_per_objfile : public allocate_on_obstack DISABLE_COPY_AND_ASSIGN (dwarf2_per_objfile); + /* Return the CU/TU given its index. + + This is intended for loops like: + + for (i = 0; i < (dwarf2_per_objfile->n_comp_units + + dwarf2_per_objfile->n_type_units); ++i) + { + dwarf2_per_cu_data *per_cu = dwarf2_per_objfile->get_cutu (i); + + ...; + } + */ + dwarf2_per_cu_data *get_cutu (int index); + + /* Return the CU given its index. + This differs from get_cutu in that it's for when you know INDEX refers to a + CU. */ + dwarf2_per_cu_data *get_cu (int index); + + /* Return the TU given its index. + This differs from get_cutu in that it's for when you know INDEX refers to a + TU. */ + signatured_type *get_tu (int index); + /* Free all cached compilation units. */ void free_cached_comp_units (); private: |