From: Simon Marchi Date: Thu, 21 Jan 2021 01:57:49 +0000 (-0500) Subject: gdb/dwarf: add some logging in dwarf2/read.c X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=17e593e9668c000f2bfa88d11a8957dfc52297dd;p=binutils-gdb.git 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 --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a2759ef32b3..35afa8e7e07 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2021-01-20 Simon Marchi + + * dwarf2/read.c (follow_die_offset): Add logging. + (dwarf2_per_objfile::age_comp_units): Add logging. + 2021-01-20 Simon Marchi * aarch64-linux-tdep.c (aarch64_linux_record_tdep): Make static. diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 9032186ef89..30e25ca3a8b 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -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); }