aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@efficios.com>2020-02-26 10:11:55 -0500
committerSimon Marchi <simon.marchi@efficios.com>2020-05-12 15:24:51 -0400
commitbd3914c7808027e0b4a90b308718f7e5defb641b (patch)
tree6b6f4ce499f1428d56b57d6cbd3eca263bdfa2b9
parentc8b42195c29d01ce83fb230df574c3b111ce48aa (diff)
downloadgdb-bd3914c7808027e0b4a90b308718f7e5defb641b.zip
gdb-bd3914c7808027e0b4a90b308718f7e5defb641b.tar.gz
gdb-bd3914c7808027e0b4a90b308718f7e5defb641b.tar.bz2
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.
-rw-r--r--gdb/dwarf2/read.c42
-rw-r--r--gdb/dwarf2/read.h7
2 files changed, 28 insertions, 21 deletions
diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 63449cf..e8ba115 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -1568,7 +1568,8 @@ static void prepare_one_comp_unit (struct dwarf2_cu *cu,
static void age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile);
-static void free_one_cached_comp_unit (struct dwarf2_per_cu_data *);
+static void free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu,
+ dwarf2_per_objfile *per_objfile);
static struct type *set_die_type (struct die_info *, struct type *,
struct dwarf2_cu *);
@@ -1602,7 +1603,8 @@ static struct type *get_die_type_at_offset (sect_offset,
static struct type *get_die_type (struct die_info *die, struct dwarf2_cu *cu);
-static void queue_comp_unit (struct dwarf2_per_cu_data *per_cu,
+static void queue_comp_unit (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
enum language pretend_language);
static void process_queue (struct dwarf2_per_objfile *dwarf2_per_objfile);
@@ -1642,7 +1644,7 @@ dwarf2_queue_item::~dwarf2_queue_item ()
if (per_cu->queued)
{
if (per_cu->cu != NULL)
- free_one_cached_comp_unit (per_cu);
+ free_one_cached_comp_unit (per_cu, per_objfile);
per_cu->queued = 0;
}
}
@@ -2381,7 +2383,7 @@ dw2_do_instantiate_symtab (dwarf2_per_cu_data *per_cu,
if (!dwarf2_per_objfile->symtab_set_p (per_cu))
{
- queue_comp_unit (per_cu, language_minimal);
+ queue_comp_unit (per_cu, dwarf2_per_objfile, language_minimal);
load_cu (per_cu, dwarf2_per_objfile, skip_partial);
/* 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,
read in the compilation unit (see load_partial_dies).
This problem could be avoided, but the benefit is unclear. */
if (this_cu->cu != NULL)
- free_one_cached_comp_unit (this_cu);
+ free_one_cached_comp_unit (this_cu, per_objfile);
cutu_reader reader (this_cu, per_objfile, NULL, 0, false);
@@ -8899,11 +8901,12 @@ dwarf2_psymtab::read_symtab (struct objfile *objfile)
/* Add PER_CU to the queue. */
static void
-queue_comp_unit (struct dwarf2_per_cu_data *per_cu,
+queue_comp_unit (dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
enum language pretend_language)
{
per_cu->queued = 1;
- per_cu->per_bfd->queue.emplace (per_cu, pretend_language);
+ per_cu->per_bfd->queue.emplace (per_cu, per_objfile, pretend_language);
}
/* 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,
static int
maybe_queue_comp_unit (struct dwarf2_cu *dependent_cu,
- struct dwarf2_per_cu_data *per_cu,
+ dwarf2_per_cu_data *per_cu,
+ dwarf2_per_objfile *per_objfile,
enum language pretend_language)
{
/* 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,
}
/* Add it to the queue. */
- queue_comp_unit (per_cu, pretend_language);
+ queue_comp_unit (per_cu, per_objfile, pretend_language);
return 1;
}
@@ -9909,7 +9913,7 @@ process_imported_unit_die (struct die_info *die, struct dwarf2_cu *cu)
return;
/* If necessary, add it to the queue and load its DIEs. */
- if (maybe_queue_comp_unit (cu, per_cu, cu->language))
+ if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
load_full_comp_unit (per_cu, per_objfile, false, cu->language);
cu->per_cu->imported_symtabs_push (per_cu);
@@ -12823,7 +12827,7 @@ queue_and_load_dwo_tu (void **slot, void *info)
/* We pass NULL for DEPENDENT_CU because we don't yet know if there's
a real dependency of PER_CU on SIG_TYPE. That is detected later
while processing PER_CU. */
- if (maybe_queue_comp_unit (NULL, sig_cu, cu->language))
+ if (maybe_queue_comp_unit (NULL, sig_cu, cu->per_objfile, cu->language))
load_full_type_unit (sig_cu, cu->per_objfile);
cu->per_cu->imported_symtabs_push (sig_cu);
}
@@ -22208,7 +22212,7 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
dwarf2_per_objfile);
/* If necessary, add it to the queue and load its DIEs. */
- if (maybe_queue_comp_unit (cu, per_cu, cu->language))
+ if (maybe_queue_comp_unit (cu, per_cu, dwarf2_per_objfile, cu->language))
load_full_comp_unit (per_cu, dwarf2_per_objfile, false, cu->language);
target_cu = per_cu->cu;
@@ -22571,6 +22575,8 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
struct die_info temp_die;
struct dwarf2_cu *sig_cu, *cu = *ref_cu;
struct die_info *die;
+ dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile;
+
/* While it might be nice to assert sig_type->type == NULL here,
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,
/* If necessary, add it to the queue and load its DIEs. */
- if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, language_minimal))
- read_signatured_type (sig_type, (*ref_cu)->per_objfile);
+ if (maybe_queue_comp_unit (*ref_cu, &sig_type->per_cu, dwarf2_per_objfile,
+ language_minimal))
+ read_signatured_type (sig_type, dwarf2_per_objfile);
sig_cu = sig_type->per_cu.cu;
gdb_assert (sig_cu != NULL);
@@ -22589,8 +22596,6 @@ follow_die_sig_1 (struct die_info *src_die, struct signatured_type *sig_type,
to_underlying (temp_die.sect_off));
if (die)
{
- struct dwarf2_per_objfile *dwarf2_per_objfile = (*ref_cu)->per_objfile;
-
/* For .gdb_index version 7 keep track of included TUs.
http://sourceware.org/bugzilla/show_bug.cgi?id=15021. */
if (dwarf2_per_objfile->per_bfd->index_table != NULL
@@ -23568,11 +23573,10 @@ age_cached_comp_units (struct dwarf2_per_objfile *dwarf2_per_objfile)
/* Remove a single compilation unit from the cache. */
static void
-free_one_cached_comp_unit (struct dwarf2_per_cu_data *target_per_cu)
+free_one_cached_comp_unit (dwarf2_per_cu_data *target_per_cu,
+ dwarf2_per_objfile *dwarf2_per_objfile)
{
struct dwarf2_per_cu_data *per_cu, **last_chain;
- struct dwarf2_per_objfile *dwarf2_per_objfile
- = target_per_cu->dwarf2_per_objfile;
per_cu = dwarf2_per_objfile->per_bfd->read_in_chain;
last_chain = &dwarf2_per_objfile->per_bfd->read_in_chain;
diff --git a/gdb/dwarf2/read.h b/gdb/dwarf2/read.h
index dda5ed7..3dada48 100644
--- a/gdb/dwarf2/read.h
+++ b/gdb/dwarf2/read.h
@@ -52,8 +52,10 @@ struct signatured_type;
for. */
struct dwarf2_queue_item
{
- dwarf2_queue_item (dwarf2_per_cu_data *cu, enum language lang)
+ dwarf2_queue_item (dwarf2_per_cu_data *cu, dwarf2_per_objfile *per_objfile,
+ enum language lang)
: per_cu (cu),
+ per_objfile (per_objfile),
pretend_language (lang)
{
}
@@ -62,7 +64,8 @@ struct dwarf2_queue_item
DISABLE_COPY_AND_ASSIGN (dwarf2_queue_item);
- struct dwarf2_per_cu_data *per_cu;
+ dwarf2_per_cu_data *per_cu;
+ dwarf2_per_objfile *per_objfile;
enum language pretend_language;
};