gdb/dwarf: add some logging in dwarf2/read.c

This patch adds some logging that helped me diagnose the problems fixed
later in this series.  I'm thinking that if it helped me now, it could
help somebody else (or myself) in the future, so I might as well add
them for real.

They can happen quite frequently and be noisy, so I used
dwarf_read_debug_printf_v for them, which means they'll only print if
`set debug dwarf-read` is >= 2.

gdb/ChangeLog:

	* dwarf2/read.c (follow_die_offset): Add logging.
	(dwarf2_per_objfile::age_comp_units): Add logging.

Change-Id: I7483c0b05c37bc9710b9b5d40e272935bc010863
This commit is contained in:
Simon Marchi
2021-01-20 20:57:49 -05:00
parent 6bd434d6ca
commit 17e593e966
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
* dwarf2/read.c (follow_die_offset): Add logging.
(dwarf2_per_objfile::age_comp_units): Add logging.
2021-01-20 Simon Marchi <simon.marchi@polymtl.ca>
* aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static.

View File

@ -23574,6 +23574,12 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
target_cu = cu;
dwarf_read_debug_printf_v ("source CU offset: %s, target offset: %s, "
"source CU contains target offset: %d",
sect_offset_str (cu->per_cu->sect_off),
sect_offset_str (sect_off),
cu->header.offset_in_cu_p (sect_off));
if (cu->per_cu->is_debug_types)
{
/* .debug_types CUs cannot reference anything outside their CU.
@ -23590,6 +23596,11 @@ follow_die_offset (sect_offset sect_off, int offset_in_dwz,
per_cu = dwarf2_find_containing_comp_unit (sect_off, offset_in_dwz,
per_objfile);
dwarf_read_debug_printf_v ("target CU offset: %s, "
"target CU DIEs loaded: %d",
sect_offset_str (per_cu->sect_off),
per_objfile->get_cu (per_cu) != nullptr);
/* If necessary, add it to the queue and load its DIEs. */
if (maybe_queue_comp_unit (cu, per_cu, per_objfile, cu->language))
load_full_comp_unit (per_cu, per_objfile, per_objfile->get_cu (per_cu),
@ -24970,6 +24981,8 @@ dwarf2_per_objfile::set_cu (dwarf2_per_cu_data *per_cu, dwarf2_cu *cu)
void
dwarf2_per_objfile::age_comp_units ()
{
dwarf_read_debug_printf_v ("running");
/* Start by clearing all marks. */
for (auto pair : m_dwarf2_cus)
pair.second->mark = false;
@ -24992,6 +25005,8 @@ dwarf2_per_objfile::age_comp_units ()
if (!cu->mark)
{
dwarf_read_debug_printf_v ("deleting old CU %s",
sect_offset_str (cu->per_cu->sect_off));
delete cu;
it = m_dwarf2_cus.erase (it);
}