From 5989a64ed5ee7a7f9c0fc284f66ef4bd414ad6c2 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 27 May 2020 11:13:50 -0400 Subject: Split dwarf2_per_objfile into dwarf2_per_objfile and dwarf2_per_bfd This is the first step of splitting dwarf2_per_objfile in two, one structure for objfile-independent data (dwarf2_per_bfd) and one for objfile-dependent data (dwarf2_per_objfile). The existing dwarf2_per_objfile is renamed dwarf2_per_bfd, and a new dwarf2_per_objfile type is introduced, which sits "in between" the objfile and dwarf2_per_bfd. So where we had this before: objfile -> dwarf2_per_objfile (*) we now have this: objfile -> dwarf2_per_objfile -> dwarf2_per_bfd (*) (*) Note that the dwarf2_per_objfile in the former corresponds to the dwarf2_per_bfd in the latter. I've done the minimal amount of changes in this patch: following patches will incrementally move things that are not actually shareable between objfiles from dwarf2_per_bfd to dwarf2_per_objfile. Most references to dwarf2_per_objfile objects are changed to dwarf2_per_objfile->per_bfd. To avoid many of these replacements, which would have to be reverted later anyway, I've moved right away the objfile backlink to the new dwarf2_per_objfile structure in this patch. I've also moved the read_line_string method, since it references the objfile backlink, and it's actually not difficult to move. Once the moves are completed, multiple dwarf2_per_objfile sharing the same BFD will point to the same single instance of dwarf2_per_bfd (as long as they don't require relocation). dwarf2_has_info, where we create these objects, is updated to the new architecture. I've had to change the get_gdb_index_contents_ftype typedef and related functions. The parameter type was changed from dwarf2_per_objfile to dwarf2_per_bfd, otherwise the template wouldn't work. Please excuse the terse ChangeLog entry, I have not listed all the functions where dwarf2_per_objfile has been changed to dwarf2_per_objfile->per_bfd. It would take a considerable amount of time and would not really be useful in the end. gdb/ChangeLog: * dwarf2/read.h (dwarf2_per_objfile): Rename to dwarf2_per_bfd, then introduce a new dwarf2_per_objfile type. : Move to the new dwarf2_per_objfile type. : Likewise. (dwarf2_per_bfd): Rename dwarf2_per_objfile to this. * dwarf2/read.c: Replace references to dwarf2_per_objfile with dwarf2_per_objfile->per_bfd. (dwarf2_per_objfile::dwarf2_per_objfile): Rename to... (dwarf2_per_bfd::dwarf2_per_bfd): ... this. (dwarf2_per_objfile::free_cached_comp_units): Rename to... (dwarf2_per_bfd::free_cached_comp_units): ... this. (dwarf2_has_info): Allocate dwarf2_per_bfd. (dwarf2_per_objfile::locate_sections): Rename to... (dwarf2_per_bfd::locate_sections): ... this. (dwarf2_per_objfile::get_cutu): Rename to... (dwarf2_per_bfd::get_cutu): ... this. (dwarf2_per_objfile::get_cu): Rename to... (dwarf2_per_bfd::get_cu): ... this. (dwarf2_per_objfile::get_tu): Rename to... (dwarf2_per_bfd::get_tu): ... this. (dwarf2_per_objfile::allocate_per_cu): Rename to... (dwarf2_per_bfd::allocate_per_cu): ... this. (dwarf2_per_objfile::allocate_signatured_type): Rename to... (dwarf2_per_bfd::allocate_signatured_type): ... this. (get_gdb_index_contents_ftype): Change parameter from dwarf2_per_objfile to dwarf2_per_bfd. * dwarf2/macro.c, dwarf2/index-write.c: Replace references to dwarf2_per_objfile with dwarf2_per_objfile->per_bfd. Change-Id: I7de7b5d1ce7494aa73bfcf15f719d3c5c46e138c --- gdb/dwarf2/macro.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gdb/dwarf2/macro.c') diff --git a/gdb/dwarf2/macro.c b/gdb/dwarf2/macro.c index 6c2d251..c258019 100644 --- a/gdb/dwarf2/macro.c +++ b/gdb/dwarf2/macro.c @@ -512,9 +512,9 @@ dwarf_decode_macro_bytes (struct dwarf2_per_objfile *dwarf2_per_objfile, body = dwz->read_string (objfile, str_offset); } else - body = dwarf2_per_objfile->str.read_string (objfile, - str_offset, - "DW_FORM_strp"); + body = dwarf2_per_objfile->per_bfd->str.read_string (objfile, + str_offset, + "DW_FORM_strp"); } is_define = (macinfo_type == DW_MACRO_define -- cgit v1.1