[v2,01/17] Refactor 'maint set dwarf synchronous' handling

Message ID 20240117-debug-names-fix-v2-1-dbd5971a9c31@tromey.com
State New
Headers
Series Rewrite .debug_names reader and writer |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gdb_build--master-arm fail Patch failed to apply

Commit Message

Tom Tromey Jan. 17, 2024, 4:39 p.m. UTC
  The new .debug_names reader will reuse the background reading
infrastructure of the cooked index code.  In order to share the
handling of 'maint set dwarf synchronous' -- and to avoid having to
export this global -- this patch refactors this to be handled directly
in dwarf2_initialize_objfile.
---
 gdb/dwarf2/read.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c
index 8f2b7a35f27..e0eb1f9ce3c 100644
--- a/gdb/dwarf2/read.c
+++ b/gdb/dwarf2/read.c
@@ -3267,6 +3267,10 @@  dwarf2_initialize_objfile (struct objfile *objfile,
       global_index_cache.miss ();
       objfile->qf.push_front (make_cooked_index_funcs (per_objfile));
     }
+
+  if (dwarf_synchronous && per_bfd->index_table != nullptr)
+    per_bfd->index_table->wait_completely ();
+
   return true;
 }
 
@@ -16920,9 +16924,6 @@  make_cooked_index_funcs (dwarf2_per_objfile *per_objfile)
      avoids races.  */
   idx->start_reading ();
 
-  if (dwarf_synchronous)
-    idx->wait_completely ();
-
   return quick_symbol_functions_up (new cooked_index_functions);
 }