GNU Binutils with patches for OS216
Revision | bd3914c7808027e0b4a90b308718f7e5defb641b (tree) |
---|---|
Zeit | 2020-05-13 04:24:51 |
Autor | Simon Marchi <simon.marchi@effi...> |
Commiter | Simon Marchi |
Add dwarf2_per_objfile parameter to free_one_cached_comp_unit
This allows removing some references to
dwarf2_per_cu_data::dwarf2_per_objfile.
gdb/ChangeLog:
* dwarf2/read.h (struct dwarf2_queue_item): Add
dwarf2_per_objfile parameter, assign new parameter.
<per_objfile>: New field.
* dwarf2/read.c (free_one_cached_comp_unit): Add
dwarf2_per_objfile parameter.
(queue_comp_unit): Likewise.
(dw2_do_instantiate_symtab): Update.
(process_psymtab_comp_unit): Update.
(maybe_queue_comp_unit): Add dwarf2_per_objfile parameter.
(process_imported_unit_die): Update.
(queue_and_load_dwo_tu): Update.
(follow_die_offset): Update.
(follow_die_sig_1): Update.
@@ -1568,7 +1568,8 @@ static void prepare_one_comp_unit (struct dwarf2_cu *cu, | ||
1568 | 1568 | |
1569 | 1569 | static void age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile); |
1570 | 1570 | |
1571 | -static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *); | |
1571 | +static void free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu, | |
1572 | + dwarf2_per_objfile *per_objfile); | |
1572 | 1573 | |
1573 | 1574 | static struct type *set_die_type (struct die_info *, struct type *, |
1574 | 1575 | struct dwarf2_cu *); |
@@ -1602,7 +1603,8 @@ static struct type *get_die_type_at_offset (sect_offset, | ||
1602 | 1603 | |
1603 | 1604 | static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu); |
1604 | 1605 | |
1605 | -static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu, | |
1606 | +static void queue_comp_unit (dwarf2_per_cu_data *per_cu, | |
1607 | + dwarf2_per_objfile *per_objfile, | |
1606 | 1608 | enum language pretend_language); |
1607 | 1609 | |
1608 | 1610 | static void process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile); |
@@ -1642,7 +1644,7 @@ dwarf2_queue_item::~dwarf2_queue_item () | ||
1642 | 1644 | if (per_cu->queued) |
1643 | 1645 | { |
1644 | 1646 | if (per_cu->cu != NULL) |
1645 | - free_one_cached_comp_unit (per_cu); | |
1647 | + free_one_cached_comp_unit (per_cu, per_objfile); | |
1646 | 1648 | per_cu->queued = 0; |
1647 | 1649 | } |
1648 | 1650 | } |
@@ -2381,7 +2383,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu, | ||
2381 | 2383 | |
2382 | 2384 | if (!dwarf2_per_objfile->symtab_set_p (per_cu)) |
2383 | 2385 | { |
2384 | - queue_comp_unit (per_cu, language_minimal); | |
2386 | + queue_comp_unit (per_cu, dwarf2_per_objfile, language_minimal); | |
2385 | 2387 | load_cu (per_cu, dwarf2_per_objfile, skip_partial); |
2386 | 2388 | |
2387 | 2389 | /* If we just loaded a CU from a DWO, and we're working with an index |
@@ -7541,7 +7543,7 @@ process_psymtab_comp_unit (dwarf2_per_cu_data *this_cu, | ||
7541 | 7543 | read in the compilation unit (see load_partial_dies). |
7542 | 7544 | This problem could be avoided, but the benefit is unclear. */ |
7543 | 7545 | if (this_cu->cu != NULL) |
7544 | - free_one_cached_comp_unit (this_cu); | |
7546 | + free_one_cached_comp_unit (this_cu, per_objfile); | |
7545 | 7547 | |
7546 | 7548 | cutu_reader reader (this_cu, per_objfile, NULL, 0, false); |
7547 | 7549 |
@@ -8899,11 +8901,12 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile) | ||
8899 | 8901 | /* Add PER_CU to the queue. */ |
8900 | 8902 | |
8901 | 8903 | static void |
8902 | -queue_comp_unit (struct dwarf2_per_cu_data *per_cu, | |
8904 | +queue_comp_unit (dwarf2_per_cu_data *per_cu, | |
8905 | + dwarf2_per_objfile *per_objfile, | |
8903 | 8906 | enum language pretend_language) |
8904 | 8907 | { |
8905 | 8908 | per_cu->queued = 1; |
8906 | - per_cu->per_bfd->queue.emplace (per_cu, pretend_language); | |
8909 | + per_cu->per_bfd->queue.emplace (per_cu, per_objfile, pretend_language); | |
8907 | 8910 | } |
8908 | 8911 | |
8909 | 8912 | /* If PER_CU is not yet queued, add it to the queue. |
@@ -8917,7 +8920,8 @@ queue_comp_unit (struct dwarf2_per_cu_data *per_cu, | ||
8917 | 8920 | |
8918 | 8921 | static int |
8919 | 8922 | maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, |
8920 | - struct dwarf2_per_cu_data *per_cu, | |
8923 | + dwarf2_per_cu_data *per_cu, | |
8924 | + dwarf2_per_objfile *per_objfile, | |
8921 | 8925 | enum language pretend_language) |
8922 | 8926 | { |
8923 | 8927 | /* We may arrive here during partial symbol reading, if we need full |
@@ -8948,7 +8952,7 @@ maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu, | ||
8948 | 8952 | } |
8949 | 8953 | |
8950 | 8954 | /* Add it to the queue. */ |
8951 | - queue_comp_unit (per_cu, pretend_language); | |
8955 | + queue_comp_unit (per_cu, per_objfile, pretend_language); | |
8952 | 8956 | |
8953 | 8957 | return 1; |
8954 | 8958 | } |
@@ -9909,7 +9913,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu) | ||
9909 | 9913 | return; |
9910 | 9914 | |
9911 | 9915 | /* If necessary, add it to the queue and load its DIEs. */ |
9912 | - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) | |
9916 | + if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language)) | |
9913 | 9917 | load_full_comp_unit (per_cu, per_objfile, false, cu->language); |
9914 | 9918 | |
9915 | 9919 | cu->per_cu->imported_symtabs_push (per_cu); |
@@ -12823,7 +12827,7 @@ queue_and_load_dwo_tu (void **slot, void *info) | ||
12823 | 12827 | /* We pass NULL for DEPENDENT_CU because we don't yet know if there's |
12824 | 12828 | a real dependency of PER_CU on SIG_TYPE. That is detected later |
12825 | 12829 | while processing PER_CU. */ |
12826 | - if (maybe_queue_comp_unit (NULL, sig_cu, cu->language)) | |
12830 | + if (maybe_queue_comp_unit (NULL, sig_cu, cu->per_objfile, cu->language)) | |
12827 | 12831 | load_full_type_unit (sig_cu, cu->per_objfile); |
12828 | 12832 | cu->per_cu->imported_symtabs_push (sig_cu); |
12829 | 12833 | } |
@@ -22208,7 +22212,7 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz, | ||
22208 | 22212 | dwarf2_per_objfile); |
22209 | 22213 | |
22210 | 22214 | /* If necessary, add it to the queue and load its DIEs. */ |
22211 | - if (maybe_queue_comp_unit (cu, per_cu, cu->language)) | |
22215 | + if (maybe_queue_comp_unit (cu, per_cu, dwarf2_per_objfile, cu->language)) | |
22212 | 22216 | load_full_comp_unit (per_cu, dwarf2_per_objfile, false, cu->language); |
22213 | 22217 | |
22214 | 22218 | target_cu = per_cu->cu; |
@@ -22571,6 +22575,8 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, | ||
22571 | 22575 | struct die_info temp_die; |
22572 | 22576 | struct dwarf2_cu *sig_cu, *cu = *ref_cu; |
22573 | 22577 | struct die_info *die; |
22578 | + dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile; | |
22579 | + | |
22574 | 22580 | |
22575 | 22581 | /* While it might be nice to assert sig_type->type == NULL here, |
22576 | 22582 | we can get here for DW_AT_imported_declaration where we need |
@@ -22578,8 +22584,9 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, | ||
22578 | 22584 | |
22579 | 22585 | /* If necessary, add it to the queue and load its DIEs. */ |
22580 | 22586 | |
22581 | - if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, language_minimal)) | |
22582 | - read_signatured_type (sig_type, (*ref_cu)->per_objfile); | |
22587 | + if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, dwarf2_per_objfile, | |
22588 | + language_minimal)) | |
22589 | + read_signatured_type (sig_type, dwarf2_per_objfile); | |
22583 | 22590 | |
22584 | 22591 | sig_cu = sig_type->per_cu.cu; |
22585 | 22592 | gdb_assert (sig_cu != NULL); |
@@ -22589,8 +22596,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type, | ||
22589 | 22596 | to_underlying (temp_die.sect_off)); |
22590 | 22597 | if (die) |
22591 | 22598 | { |
22592 | - struct dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile; | |
22593 | - | |
22594 | 22599 | /* For .gdb_index version 7 keep track of included TUs. |
22595 | 22600 | http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */ |
22596 | 22601 | if (dwarf2_per_objfile->per_bfd->index_table != NULL |
@@ -23568,11 +23573,10 @@ age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile) | ||
23568 | 23573 | /* Remove a single compilation unit from the cache. */ |
23569 | 23574 | |
23570 | 23575 | static void |
23571 | -free_one_cached_comp_unit (struct dwarf2_per_cu_data *target_per_cu) | |
23576 | +free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu, | |
23577 | + dwarf2_per_objfile *dwarf2_per_objfile) | |
23572 | 23578 | { |
23573 | 23579 | struct dwarf2_per_cu_data *per_cu, **last_chain; |
23574 | - struct dwarf2_per_objfile *dwarf2_per_objfile | |
23575 | - = target_per_cu->dwarf2_per_objfile; | |
23576 | 23580 | |
23577 | 23581 | per_cu = dwarf2_per_objfile->per_bfd->read_in_chain; |
23578 | 23582 | last_chain = &dwarf2_per_objfile->per_bfd->read_in_chain; |
@@ -52,8 +52,10 @@ struct signatured_type; | ||
52 | 52 | for. */ |
53 | 53 | struct dwarf2_queue_item |
54 | 54 | { |
55 | - dwarf2_queue_item (dwarf2_per_cu_data *cu, enum language lang) | |
55 | + dwarf2_queue_item (dwarf2_per_cu_data *cu, dwarf2_per_objfile *per_objfile, | |
56 | + enum language lang) | |
56 | 57 | : per_cu (cu), |
58 | + per_objfile (per_objfile), | |
57 | 59 | pretend_language (lang) |
58 | 60 | { |
59 | 61 | } |
@@ -62,7 +64,8 @@ struct dwarf2_queue_item | ||
62 | 64 | |
63 | 65 | DISABLE_COPY_AND_ASSIGN (dwarf2_queue_item); |
64 | 66 | |
65 | - struct dwarf2_per_cu_data *per_cu; | |
67 | + dwarf2_per_cu_data *per_cu; | |
68 | + dwarf2_per_objfile *per_objfile; | |
66 | 69 | enum language pretend_language; |
67 | 70 | }; |
68 | 71 |