gdb/dwarf: add some logging in dwarf2/read.c
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 21 Jan 2021 01:57:49 +0000 (20:57 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Thu, 21 Jan 2021 01:57:49 +0000 (20:57 -0500)
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

gdb/ChangeLog
gdb/dwarf2/read.c

index a2759ef32b3dd6c127724c2e01240993b478027e..35afa8e7e07e0c9f6129f700b90211cd70cb76d0 100644 (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.
index 9032186ef89ea0f42b80b454f7e3e5c24eef2e75..30e25ca3a8b7a6386982d525ccf51af67b9a08d6 100644 (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);
        }