GNU Binutils with patches for OS216
修订版 | d4b0ea16296c8ba432e5110d696acdd6979216e4 (tree) |
---|---|
时间 | 2020-05-13 04:24:51 |
作者 | Simon Marchi <simon.marchi@poly...> |
Commiter | Simon Marchi |
Pass dwarf2_per_bfd instead of dwarf2_per_objfile to some index-related functions
All these functions actually only need to receive a dwarf2_per_bfd, pass
that instead of dwarf2_per_objfile.
gdb/ChangeLog:
* dwarf2/read.c (create_cu_from_index_list): Replace
dwarf2_per_objfile parameter with dwarf2_per_bfd.
(create_cus_from_index_list): Likewise.
(create_cus_from_index): Likewise.
(create_signatured_type_table_from_index): Likewise.
(create_cus_from_debug_names_list): Likewise.
(create_cus_from_debug_names): Likewise.
(dwarf2_read_gdb_index): Update.
(dwarf2_read_debug_names): Update.
@@ -2474,20 +2474,20 @@ dwarf2_per_bfd::allocate_signatured_type () | ||
2474 | 2474 | return result; |
2475 | 2475 | } |
2476 | 2476 | |
2477 | -/* Return a new dwarf2_per_cu_data allocated on the dwarf2_per_objfile | |
2477 | +/* Return a new dwarf2_per_cu_data allocated on the per-bfd | |
2478 | 2478 | obstack, and constructed with the specified field values. */ |
2479 | 2479 | |
2480 | 2480 | static dwarf2_per_cu_data * |
2481 | -create_cu_from_index_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
2482 | - struct dwarf2_section_info *section, | |
2483 | - int is_dwz, | |
2484 | - sect_offset sect_off, ULONGEST length) | |
2481 | +create_cu_from_index_list (dwarf2_per_bfd *per_bfd, | |
2482 | + struct dwarf2_section_info *section, | |
2483 | + int is_dwz, | |
2484 | + sect_offset sect_off, ULONGEST length) | |
2485 | 2485 | { |
2486 | - dwarf2_per_cu_data *the_cu = dwarf2_per_objfile->per_bfd->allocate_per_cu (); | |
2486 | + dwarf2_per_cu_data *the_cu = per_bfd->allocate_per_cu (); | |
2487 | 2487 | the_cu->sect_off = sect_off; |
2488 | 2488 | the_cu->length = length; |
2489 | 2489 | the_cu->section = section; |
2490 | - the_cu->v.quick = OBSTACK_ZALLOC (&dwarf2_per_objfile->per_bfd->obstack, | |
2490 | + the_cu->v.quick = OBSTACK_ZALLOC (&per_bfd->obstack, | |
2491 | 2491 | struct dwarf2_per_cu_quick_data); |
2492 | 2492 | the_cu->is_dwz = is_dwz; |
2493 | 2493 | return the_cu; |
@@ -2497,7 +2497,7 @@ create_cu_from_index_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
2497 | 2497 | CUs. */ |
2498 | 2498 | |
2499 | 2499 | static void |
2500 | -create_cus_from_index_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
2500 | +create_cus_from_index_list (dwarf2_per_bfd *per_bfd, | |
2501 | 2501 | const gdb_byte *cu_list, offset_type n_elements, |
2502 | 2502 | struct dwarf2_section_info *section, |
2503 | 2503 | int is_dwz) |
@@ -2512,32 +2512,31 @@ create_cus_from_index_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
2512 | 2512 | cu_list += 2 * 8; |
2513 | 2513 | |
2514 | 2514 | dwarf2_per_cu_data *per_cu |
2515 | - = create_cu_from_index_list (dwarf2_per_objfile, section, is_dwz, | |
2516 | - sect_off, length); | |
2517 | - dwarf2_per_objfile->per_bfd->all_comp_units.push_back (per_cu); | |
2515 | + = create_cu_from_index_list (per_bfd, section, is_dwz, sect_off, | |
2516 | + length); | |
2517 | + per_bfd->all_comp_units.push_back (per_cu); | |
2518 | 2518 | } |
2519 | 2519 | } |
2520 | 2520 | |
2521 | 2521 | /* Read the CU list from the mapped index, and use it to create all |
2522 | - the CU objects for this objfile. */ | |
2522 | + the CU objects for PER_BFD. */ | |
2523 | 2523 | |
2524 | 2524 | static void |
2525 | -create_cus_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
2525 | +create_cus_from_index (dwarf2_per_bfd *per_bfd, | |
2526 | 2526 | const gdb_byte *cu_list, offset_type cu_list_elements, |
2527 | 2527 | const gdb_byte *dwz_list, offset_type dwz_elements) |
2528 | 2528 | { |
2529 | - gdb_assert (dwarf2_per_objfile->per_bfd->all_comp_units.empty ()); | |
2530 | - dwarf2_per_objfile->per_bfd->all_comp_units.reserve | |
2531 | - ((cu_list_elements + dwz_elements) / 2); | |
2529 | + gdb_assert (per_bfd->all_comp_units.empty ()); | |
2530 | + per_bfd->all_comp_units.reserve ((cu_list_elements + dwz_elements) / 2); | |
2532 | 2531 | |
2533 | - create_cus_from_index_list (dwarf2_per_objfile, cu_list, cu_list_elements, | |
2534 | - &dwarf2_per_objfile->per_bfd->info, 0); | |
2532 | + create_cus_from_index_list (per_bfd, cu_list, cu_list_elements, | |
2533 | + &per_bfd->info, 0); | |
2535 | 2534 | |
2536 | 2535 | if (dwz_elements == 0) |
2537 | 2536 | return; |
2538 | 2537 | |
2539 | - dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd); | |
2540 | - create_cus_from_index_list (dwarf2_per_objfile, dwz_list, dwz_elements, | |
2538 | + dwz_file *dwz = dwarf2_get_dwz_file (per_bfd); | |
2539 | + create_cus_from_index_list (per_bfd, dwz_list, dwz_elements, | |
2541 | 2540 | &dwz->info, 1); |
2542 | 2541 | } |
2543 | 2542 |
@@ -2545,13 +2544,11 @@ create_cus_from_index (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
2545 | 2544 | |
2546 | 2545 | static void |
2547 | 2546 | create_signatured_type_table_from_index |
2548 | - (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
2549 | - struct dwarf2_section_info *section, | |
2550 | - const gdb_byte *bytes, | |
2551 | - offset_type elements) | |
2547 | + (dwarf2_per_bfd *per_bfd, struct dwarf2_section_info *section, | |
2548 | + const gdb_byte *bytes, offset_type elements) | |
2552 | 2549 | { |
2553 | - gdb_assert (dwarf2_per_objfile->per_bfd->all_type_units.empty ()); | |
2554 | - dwarf2_per_objfile->per_bfd->all_type_units.reserve (elements / 3); | |
2550 | + gdb_assert (per_bfd->all_type_units.empty ()); | |
2551 | + per_bfd->all_type_units.reserve (elements / 3); | |
2555 | 2552 | |
2556 | 2553 | htab_up sig_types_hash = allocate_signatured_type_table (); |
2557 | 2554 |
@@ -2571,23 +2568,23 @@ create_signatured_type_table_from_index | ||
2571 | 2568 | signature = extract_unsigned_integer (bytes + 16, 8, BFD_ENDIAN_LITTLE); |
2572 | 2569 | bytes += 3 * 8; |
2573 | 2570 | |
2574 | - sig_type = dwarf2_per_objfile->per_bfd->allocate_signatured_type (); | |
2571 | + sig_type = per_bfd->allocate_signatured_type (); | |
2575 | 2572 | sig_type->signature = signature; |
2576 | 2573 | sig_type->type_offset_in_tu = type_offset_in_tu; |
2577 | 2574 | sig_type->per_cu.is_debug_types = 1; |
2578 | 2575 | sig_type->per_cu.section = section; |
2579 | 2576 | sig_type->per_cu.sect_off = sect_off; |
2580 | 2577 | sig_type->per_cu.v.quick |
2581 | - = OBSTACK_ZALLOC (&dwarf2_per_objfile->per_bfd->obstack, | |
2578 | + = OBSTACK_ZALLOC (&per_bfd->obstack, | |
2582 | 2579 | struct dwarf2_per_cu_quick_data); |
2583 | 2580 | |
2584 | 2581 | slot = htab_find_slot (sig_types_hash.get (), sig_type, INSERT); |
2585 | 2582 | *slot = sig_type; |
2586 | 2583 | |
2587 | - dwarf2_per_objfile->per_bfd->all_type_units.push_back (sig_type); | |
2584 | + per_bfd->all_type_units.push_back (sig_type); | |
2588 | 2585 | } |
2589 | 2586 | |
2590 | - dwarf2_per_objfile->per_bfd->signatured_types = std::move (sig_types_hash); | |
2587 | + per_bfd->signatured_types = std::move (sig_types_hash); | |
2591 | 2588 | } |
2592 | 2589 | |
2593 | 2590 | /* Create the signatured type hash table from .debug_names. */ |
@@ -3106,7 +3103,7 @@ dwarf2_read_gdb_index | ||
3106 | 3103 | } |
3107 | 3104 | } |
3108 | 3105 | |
3109 | - create_cus_from_index (dwarf2_per_objfile, cu_list, cu_list_elements, | |
3106 | + create_cus_from_index (dwarf2_per_objfile->per_bfd, cu_list, cu_list_elements, | |
3110 | 3107 | dwz_list, dwz_list_elements); |
3111 | 3108 | |
3112 | 3109 | if (types_list_elements) |
@@ -3118,8 +3115,9 @@ dwarf2_read_gdb_index | ||
3118 | 3115 | |
3119 | 3116 | dwarf2_section_info *section = &dwarf2_per_objfile->per_bfd->types[0]; |
3120 | 3117 | |
3121 | - create_signatured_type_table_from_index (dwarf2_per_objfile, section, | |
3122 | - types_list, types_list_elements); | |
3118 | + create_signatured_type_table_from_index (dwarf2_per_objfile->per_bfd, | |
3119 | + section, types_list, | |
3120 | + types_list_elements); | |
3123 | 3121 | } |
3124 | 3122 | |
3125 | 3123 | create_addrmap_from_index (dwarf2_per_objfile, map.get ()); |
@@ -5079,7 +5077,7 @@ read_debug_names_from_section (struct objfile *objfile, | ||
5079 | 5077 | list. */ |
5080 | 5078 | |
5081 | 5079 | static void |
5082 | -create_cus_from_debug_names_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
5080 | +create_cus_from_debug_names_list (dwarf2_per_bfd *per_bfd, | |
5083 | 5081 | const mapped_debug_names &map, |
5084 | 5082 | dwarf2_section_info §ion, |
5085 | 5083 | bool is_dwz) |
@@ -5098,9 +5096,8 @@ create_cus_from_debug_names_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
5098 | 5096 | the next CU as end of this CU. We create the CUs here with length 0, |
5099 | 5097 | and in cutu_reader::cutu_reader we'll fill in the actual length. */ |
5100 | 5098 | dwarf2_per_cu_data *per_cu |
5101 | - = create_cu_from_index_list (dwarf2_per_objfile, §ion, is_dwz, | |
5102 | - sect_off, 0); | |
5103 | - dwarf2_per_objfile->per_bfd->all_comp_units.push_back (per_cu); | |
5099 | + = create_cu_from_index_list (per_bfd, §ion, is_dwz, sect_off, 0); | |
5100 | + per_bfd->all_comp_units.push_back (per_cu); | |
5104 | 5101 | } |
5105 | 5102 | } |
5106 | 5103 |
@@ -5122,9 +5119,9 @@ create_cus_from_debug_names_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
5122 | 5119 | { |
5123 | 5120 | const ULONGEST length = sect_off_next - sect_off_prev; |
5124 | 5121 | dwarf2_per_cu_data *per_cu |
5125 | - = create_cu_from_index_list (dwarf2_per_objfile, §ion, is_dwz, | |
5122 | + = create_cu_from_index_list (per_bfd, §ion, is_dwz, | |
5126 | 5123 | sect_off_prev, length); |
5127 | - dwarf2_per_objfile->per_bfd->all_comp_units.push_back (per_cu); | |
5124 | + per_bfd->all_comp_units.push_back (per_cu); | |
5128 | 5125 | } |
5129 | 5126 | sect_off_prev = sect_off_next; |
5130 | 5127 | } |
@@ -5134,22 +5131,21 @@ create_cus_from_debug_names_list (struct dwarf2_per_objfile *dwarf2_per_objfile, | ||
5134 | 5131 | the CU objects for this dwarf2_per_objfile. */ |
5135 | 5132 | |
5136 | 5133 | static void |
5137 | -create_cus_from_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile, | |
5134 | +create_cus_from_debug_names (dwarf2_per_bfd *per_bfd, | |
5138 | 5135 | const mapped_debug_names &map, |
5139 | 5136 | const mapped_debug_names &dwz_map) |
5140 | 5137 | { |
5141 | - gdb_assert (dwarf2_per_objfile->per_bfd->all_comp_units.empty ()); | |
5142 | - dwarf2_per_objfile->per_bfd->all_comp_units.reserve (map.cu_count + dwz_map.cu_count); | |
5138 | + gdb_assert (per_bfd->all_comp_units.empty ()); | |
5139 | + per_bfd->all_comp_units.reserve (map.cu_count + dwz_map.cu_count); | |
5143 | 5140 | |
5144 | - create_cus_from_debug_names_list (dwarf2_per_objfile, map, | |
5145 | - dwarf2_per_objfile->per_bfd->info, | |
5141 | + create_cus_from_debug_names_list (per_bfd, map, per_bfd->info, | |
5146 | 5142 | false /* is_dwz */); |
5147 | 5143 | |
5148 | 5144 | if (dwz_map.cu_count == 0) |
5149 | 5145 | return; |
5150 | 5146 | |
5151 | - dwz_file *dwz = dwarf2_get_dwz_file (dwarf2_per_objfile->per_bfd); | |
5152 | - create_cus_from_debug_names_list (dwarf2_per_objfile, dwz_map, dwz->info, | |
5147 | + dwz_file *dwz = dwarf2_get_dwz_file (per_bfd); | |
5148 | + create_cus_from_debug_names_list (per_bfd, dwz_map, dwz->info, | |
5153 | 5149 | true /* is_dwz */); |
5154 | 5150 | } |
5155 | 5151 |
@@ -5188,7 +5184,7 @@ dwarf2_read_debug_names (struct dwarf2_per_objfile *dwarf2_per_objfile) | ||
5188 | 5184 | } |
5189 | 5185 | } |
5190 | 5186 | |
5191 | - create_cus_from_debug_names (dwarf2_per_objfile, *map, dwz_map); | |
5187 | + create_cus_from_debug_names (dwarf2_per_objfile->per_bfd, *map, dwz_map); | |
5192 | 5188 | |
5193 | 5189 | if (map->tu_count != 0) |
5194 | 5190 | { |