fb113f4 Make mapped_debug_names independent of objfile

Authored and Committed by Simon Marchi 3 years ago
    Make mapped_debug_names independent of objfile
    
    mapped_debug_names currently has a dwarf2_per_objfile field.  Since we
    want it to become objfile-independent, this field must be removed.
    
    This patch removes it, and then arranges for all methods that needed it
    to accept a dwarf2_per_objfile parameter.  This trickles down at various
    places, like the dw2_debug_names_iterator type.
    
    Ultimately, the objfile only seems to be needed because we might need to
    read a string from the string section.  For that, we might need to read
    in the section, and if it's a relocatable section, the objfile is needed
    in order to do the relocation.  This pattern happens often (that we to
    pass an objfile only because a section might be read).  I think it's a
    bit ugly, but I don't have a good alternative right now.
    
    gdb/ChangeLog:
    
    	* dwarf2/read.c (struct mapped_index_base) 
    	build_name_components, find_name_components_bounds>:
    	Add per_objfile parameter.
    	(struct mapped_index) <symbol_name_at>: Likewise.
    	(struct mapped_debug_names): Remove constructor.
    	<dwarf2_per_objfile>: Remove field.
    	<namei_to_name, symbol_name_at>: Add per_objfile parameter.
    	(mapped_index_base::find_name_components_bounds,
    	mapped_index_base::build_name_components,
    	dw2_expand_symtabs_matching_symbol): Likewise.
    	(class mock_mapped_index) <symbol_name_at>: Likewise.
    	(check_match): Likewise.
    	(check_find_bounds_finds): Likewise.
    	(test_mapped_index_find_name_component_bounds): Update.
    	(CHECK_MATCH): Update.
    	(dw2_expand_symtabs_matching): Update.
    	(class dw2_debug_names_iterator) <dw2_debug_names_iterator>: Add
    	per_objfile parameter.
    	<find_vec_in_debug_names>: Likewise.
    	<m_per_objfile>: New field.
    	(mapped_debug_names::namei_to_name): Add dwarf2_per_objfile
    	parameter.
    	(dw2_debug_names_iterator::find_vec_in_debug_names): Likewise.
    	(dw2_debug_names_iterator::next): Update.
    	(dw2_debug_names_lookup_symbol): Update.
    	(dw2_debug_names_expand_symtabs_for_function): Update.
    	(dw2_debug_names_map_matching_symbols): Update.
    	(dw2_debug_names_expand_symtabs_matching): Update.
    	(dwarf2_read_debug_names): Update.
    
        
file modified
+91 -72