]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: make symtab::compunit return a reference
authorSimon Marchi <simon.marchi@polymtl.ca>
Thu, 18 Jun 2026 18:39:26 +0000 (14:39 -0400)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 19 Jun 2026 14:04:11 +0000 (10:04 -0400)
The compunit symtab backlink of a symtab is never null (the constructor
asserts it), so make symtab::compunit return a reference instead of a
pointer, and have the symtab constructor take the compunit_symtab as a
reference too.  Update all callers accordingly.

This came up earlier in review, where a caller would check the result of
`symtab->compunit ()` for nullptr, and I pointed out that it was
unnecessary.  Returning a reference makes this clear.

Change-Id: Idf3a6b5fb07a10cd161826ae8a7b826d95bd96c6
Reviewed-By: Tom de Vries <tdevries@suse.de>
31 files changed:
gdb/ada-exp.y
gdb/ada-lang.c
gdb/amd64-tdep.c
gdb/annotate.c
gdb/breakpoint.c
gdb/c-exp.y
gdb/cli/cli-cmds.c
gdb/compile/compile-object-load.c
gdb/compile/compile.c
gdb/disasm.c
gdb/guile/scm-symtab.c
gdb/linespec.c
gdb/macroscope.c
gdb/mi/mi-cmd-file.c
gdb/mi/mi-symbol-cmds.c
gdb/objfiles.c
gdb/or1k-tdep.c
gdb/p-exp.y
gdb/parse.c
gdb/python/py-linetable.c
gdb/python/py-symtab.c
gdb/record-btrace.c
gdb/source-cache.c
gdb/source.c
gdb/symfile.c
gdb/symmisc.c
gdb/symtab.c
gdb/symtab.h
gdb/tui/tui-source.c
gdb/tui/tui-winsource.c
gdb/z80-tdep.c

index 5c5d4675eb6caf8d6264ee5976cdeea66d1aceac..f36426a208403b59279dc048f8680d3552c53f38 100644 (file)
@@ -1498,7 +1498,7 @@ block_lookup (const struct block *context, const char *raw_name)
     symtab = NULL;
 
   if (symtab != NULL)
-    result = symtab->compunit ()->blockvector ()->static_block ();
+    result = symtab->compunit ().blockvector ()->static_block ();
   else if (syms.empty () || syms[0].symbol->loc_class () != LOC_BLOCK)
     {
       if (context == NULL)
index 564e4d6194a836763e37f2fee5cf4456298d71fc..19d8e4ee13b755cadc0099c5f2cf7e92b6e02da2 100644 (file)
@@ -4806,7 +4806,7 @@ cache_symbol (const char *name, domain_search_flags domain,
      against the global and static blocks of its associated symtab.  */
   if (sym != nullptr)
     {
-      const blockvector &bv = *sym->symtab ()->compunit ()->blockvector ();
+      const blockvector &bv = *sym->symtab ()->compunit ().blockvector ();
 
       if (bv.global_block () != block && bv.static_block () != block)
        return;
@@ -11869,8 +11869,8 @@ is_known_support_routine (const frame_info_ptr &frame)
       re_comp (known_runtime_file_name_patterns[i]);
       if (re_exec (lbasename (sal.symtab->filename ())))
        return true;
-      if (sal.symtab->compunit ()->objfile () != NULL
-         && re_exec (objfile_name (sal.symtab->compunit ()->objfile ())))
+      if (sal.symtab->compunit ().objfile () != NULL
+         && re_exec (objfile_name (sal.symtab->compunit ().objfile ())))
        return true;
     }
 
index 99448a98f61f10a2bb0a9186c5afd1e44d4e84fb..a982e610642f4d8133910ee8fec6947b2bb94957 100644 (file)
@@ -2782,7 +2782,7 @@ amd64_skip_xmm_prologue (CORE_ADDR pc, CORE_ADDR start_pc)
   start_pc_sal = find_sal_for_pc_sect (start_pc, NULL, 0);
   if (start_pc_sal.symtab == NULL
       || producer_is_gcc_ge_4 (start_pc_sal.symtab->compunit ()
-                              ->producer ()) < 6
+                              .producer ()) < 6
       || start_pc_sal.pc != start_pc || pc >= start_pc_sal.end)
     return pc;
 
index 1f3a6d114b1855a8c4d4f694565e47bdbc1b1ec9..e6c2f896942ad5c98761c564b863c3a663f58fb8 100644 (file)
@@ -452,12 +452,12 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
        return false;
 
       annotate_source (s->fullname (), line, (int) (*offsets)[line - 1],
-                      mid_statement, s->compunit ()->objfile ()->arch (),
+                      mid_statement, s->compunit ().objfile ()->arch (),
                       pc);
 
       /* Update the current symtab and line.  */
       symtab_and_line sal;
-      sal.pspace = s->compunit ()->objfile ()->pspace ();
+      sal.pspace = s->compunit ().objfile ()->pspace ();
       sal.symtab = s;
       sal.line = line;
       set_current_source_symtab_and_line (sal);
index 72cfd3af490755e5af859878197de35e3a9268ce..e4df4df04a70bba8e546cfc06fe66c032be24d17 100644 (file)
@@ -7767,7 +7767,7 @@ get_sal_arch (struct symtab_and_line sal)
   if (sal.section != nullptr)
     return sal.section->objfile->arch ();
   if (sal.symtab != nullptr)
-    return sal.symtab->compunit ()->objfile ()->arch ();
+    return sal.symtab->compunit ().objfile ()->arch ();
 
   return nullptr;
 }
@@ -9502,13 +9502,13 @@ resolve_sal_pc (struct symtab_and_line *sal)
       struct symbol *sym;
 
       bv = blockvector_for_pc_sect (sal->pc, 0, &b,
-                                   sal->symtab->compunit ());
+                                   &sal->symtab->compunit ());
       if (bv != NULL)
        {
          sym = b->linkage_function ();
          if (sym != NULL)
            sal->section
-             = sym->obj_section (sal->symtab->compunit ()->objfile ());
+             = sym->obj_section (sal->symtab->compunit ().objfile ());
          else
            {
              /* It really is worthwhile to have the section, so we'll
@@ -14740,7 +14740,7 @@ breakpoint_free_objfile (struct objfile *objfile)
   for (bp_location *loc : all_bp_locations ())
     {
       if (loc->symtab != nullptr
-         && loc->symtab->compunit ()->objfile () == objfile)
+         && loc->symtab->compunit ().objfile () == objfile)
        {
          loc->symtab = nullptr;
          loc->symbol = nullptr;
index 2829d8bccba2db08c84b0c285284d71ba997cb2f..e6a82e2aa3cc411466b661e6aaf11979a35736d1 100644 (file)
@@ -3178,7 +3178,7 @@ classify_name (struct parser_state *par_state, const struct block *block,
              symtab != nullptr)
            {
              yylval.bval
-               = symtab->compunit ()->blockvector ()->static_block ();
+               = symtab->compunit ().blockvector ()->static_block ();
 
              return FILENAME;
            }
index 3abb2f136ec5d2bc2bfbe62f1406238b00e72bb1..f5c85dfc352c789afd9066c47acfed57b4a67fe5 100644 (file)
@@ -1044,7 +1044,7 @@ edit_command (const char *arg, int from_tty)
            error (_("No source file for address %s."),
                   paddress (get_current_arch (), sal.pc));
 
-         gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
+         gdbarch = sal.symtab->compunit ().objfile ()->arch ();
          sym = find_symbol_for_pc (sal.pc);
          if (sym)
            gdb_printf ("%ps is in %ps (%ps:%ps).\n",
@@ -1506,7 +1506,7 @@ list_command (const char *arg, int from_tty)
        error (_("No source file for address %s."),
               paddress (get_current_arch (), sal.pc));
 
-      struct gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
+      struct gdbarch *gdbarch = sal.symtab->compunit ().objfile ()->arch ();
       struct symbol *sym = find_symbol_for_pc (sal.pc);
       if (sym != nullptr)
        gdb_printf ("%ps is in %s (%ps:%ps).\n",
@@ -2329,8 +2329,8 @@ ambiguous_line_spec (gdb::array_view<const symtab_and_line> sals,
 static int
 cmp_symtabs (const symtab_and_line &sala, const symtab_and_line &salb)
 {
-  const char *dira = sala.symtab->compunit ()->dirname ();
-  const char *dirb = salb.symtab->compunit ()->dirname ();
+  const char *dira = sala.symtab->compunit ().dirname ();
+  const char *dirb = salb.symtab->compunit ().dirname ();
   int r;
 
   if (dira == NULL)
index 20e4c3e51ceffa90ad7dbf69cb4a70eee2e9f336..a70282c4e0cbea4e5b8c7a10d1517c32304f28b5 100644 (file)
@@ -426,7 +426,7 @@ get_out_value_type (struct symbol *func_sym, struct objfile *objfile,
   lookup_name_info i_ptr_matcher (COMPILE_I_EXPR_PTR_TYPE,
                                  symbol_name_match_type::SEARCH_NAME);
 
-  bv = func_sym->symtab ()->compunit ()->blockvector ();
+  bv = func_sym->symtab ()->compunit ().blockvector ();
   nblocks = bv->num_blocks ();
 
   gdb_ptr_type_sym = NULL;
index b52859b4bc8aaa4eeb8cf7be034b0fde3cd5dede..4a027de26259ba68b94a37947029d6171046ec60 100644 (file)
@@ -364,7 +364,7 @@ get_expr_block_and_pc (CORE_ADDR *pc)
        = get_current_source_symtab_and_line (current_program_space);
 
       if (cursal.symtab)
-       block = cursal.symtab->compunit ()->blockvector ()->static_block ();
+       block = cursal.symtab->compunit ().blockvector ()->static_block ();
 
       if (block != NULL)
        *pc = block->entry_pc ();
index 81c466c188afe30d75e8716aa25db01210f192b3..a61bd203b6f1dea713f14404ed5b6e8891af84c4 100644 (file)
@@ -553,7 +553,7 @@ do_mixed_source_and_assembly_deprecated
   mle = (struct deprecated_dis_line_entry *)
     alloca (nlines * sizeof (struct deprecated_dis_line_entry));
 
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
 
   unrelocated_addr unrel_low
     = unrelocated_addr (low - objfile->text_section_offset ());
@@ -701,7 +701,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch,
 
   gdb::unordered_set<dis_line_entry, dis_line_entry_hash> dis_line_table;
 
-  struct objfile *objfile = main_symtab->compunit ()->objfile ();
+  struct objfile *objfile = main_symtab->compunit ().objfile ();
 
   unrelocated_addr unrel_low
     = unrelocated_addr (low - objfile->text_section_offset ());
index b3efcaca22e2331262481932beb0970b39946a79..639b134d8e724702d244deea48940b5ca5339288 100644 (file)
@@ -136,7 +136,7 @@ stscm_eq_symtab_smob (const void *ap, const void *bp)
 static htab_t
 stscm_objfile_symtab_map (struct symtab *symtab)
 {
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
   htab_t htab = stscm_objfile_data_key.get (objfile);
 
   if (htab == NULL)
@@ -346,7 +346,7 @@ gdbscm_symtab_objfile (SCM self)
     = stscm_get_valid_symtab_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   const struct symtab *symtab = st_smob->symtab;
 
-  return ofscm_scm_from_objfile (symtab->compunit ()->objfile ());
+  return ofscm_scm_from_objfile (symtab->compunit ().objfile ());
 }
 
 /* (symtab-global-block <gdb:symtab>) -> <gdb:block>
@@ -360,10 +360,10 @@ gdbscm_symtab_global_block (SCM self)
   const struct symtab *symtab = st_smob->symtab;
   const struct blockvector *blockvector;
 
-  blockvector = symtab->compunit ()->blockvector ();
+  blockvector = symtab->compunit ().blockvector ();
   const struct block *block = blockvector->global_block ();
 
-  return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
+  return bkscm_scm_from_block (block, symtab->compunit ().objfile ());
 }
 
 /* (symtab-static-block <gdb:symtab>) -> <gdb:block>
@@ -377,10 +377,10 @@ gdbscm_symtab_static_block (SCM self)
   const struct symtab *symtab = st_smob->symtab;
   const struct blockvector *blockvector;
 
-  blockvector = symtab->compunit ()->blockvector ();
+  blockvector = symtab->compunit ().blockvector ();
   const struct block *block = blockvector->static_block ();
 
-  return bkscm_scm_from_block (block, symtab->compunit ()->objfile ());
+  return bkscm_scm_from_block (block, symtab->compunit ().objfile ());
 }
 \f
 /* Administrivia for sal (symtab-and-line) smobs.  */
index 5371d8426aec6ea1b0ea9bdf227bc62af8c19ae8..fd7918df5a11ff7d4803883e8b7309e964048e12 100644 (file)
@@ -1149,7 +1149,7 @@ iterate_over_all_matching_symtabs
                {
                  const struct block *block;
                  int i;
-                 const blockvector *bv = symtab->compunit ()->blockvector ();
+                 const blockvector *bv = symtab->compunit ().blockvector ();
 
                  for (i = FIRST_LOCAL_BLOCK; i < bv->num_blocks (); i++)
                    {
@@ -1197,7 +1197,7 @@ iterate_over_file_blocks
 {
   const struct block *block;
 
-  for (block = symtab->compunit ()->blockvector ()->static_block ();
+  for (block = symtab->compunit ().blockvector ()->static_block ();
        block != NULL;
        block = block->superblock ())
     current_language->for_each_symbol (block, name, domain, callback);
@@ -2198,7 +2198,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
       for (const auto &sym : ls->labels.label_symbols)
        {
          struct program_space *pspace
-           = sym.symbol->symtab ()->compunit ()->objfile ()->pspace ();
+           = sym.symbol->symtab ()->compunit ().objfile ()->pspace ();
          std::optional<symtab_and_line> sal
            = symbol_to_sal (state->funfirstline, sym.symbol);
 
@@ -2221,7 +2221,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec *ls)
          for (const auto &sym : ls->function_symbols)
            {
              program_space *pspace
-               = sym.symbol->symtab ()->compunit ()->objfile ()->pspace ();
+               = sym.symbol->symtab ()->compunit ().objfile ()->pspace ();
              set_current_program_space (pspace);
 
              /* Don't skip to the first line of the function if we
@@ -3403,7 +3403,7 @@ lookup_prefix_sym (struct linespec_state *state,
        {
          /* Program spaces that are executing startup should have
             been filtered out earlier.  */
-         program_space *pspace = elt->compunit ()->objfile ()->pspace ();
+         program_space *pspace = elt->compunit ().objfile ()->pspace ();
 
          gdb_assert (!pspace->executing_startup);
          set_current_program_space (pspace);
@@ -3452,8 +3452,8 @@ compare_symbols (const block_symbol &a, const block_symbol &b)
      which gives unstable sorting results.  While the assumption is that this
      doesn't matter, play it safe and compare program space IDs instead.  */
   int cmp
-    = compare_pspace (a.symbol->symtab ()->compunit ()->objfile ()->pspace (),
-                     b.symbol->symtab ()->compunit ()->objfile ()->pspace ());
+    = compare_pspace (a.symbol->symtab ()->compunit ().objfile ()->pspace (),
+                     b.symbol->symtab ()->compunit ().objfile ()->pspace ());
   if (cmp == -1)
     return true;
   if (cmp == 1)
@@ -3560,7 +3560,7 @@ find_method (struct linespec_state *self,
 
       /* Program spaces that are executing startup should have
         been filtered out earlier.  */
-      pspace = sym->symtab ()->compunit ()->objfile ()->pspace ();
+      pspace = sym->symtab ()->compunit ().objfile ()->pspace ();
       gdb_assert (!pspace->executing_startup);
       set_current_program_space (pspace);
       t = check_typedef (sym->type ());
@@ -3572,7 +3572,7 @@ find_method (struct linespec_state *self,
       if (ix == sym_classes->size () - 1
          || (pspace
              != (sym_classes->at (ix + 1).symbol->symtab ()
-                 ->compunit ()->objfile ()->pspace ())))
+                 ->compunit ().objfile ()->pspace ())))
        {
          /* If we did not find a direct implementation anywhere in
             this program space, consider superclasses.  */
@@ -3891,7 +3891,7 @@ find_label_symbols (struct linespec_state *self,
        {
          fn_sym = elt.symbol;
          set_current_program_space
-           (fn_sym->symtab ()->compunit ()->objfile ()->pspace ());
+           (fn_sym->symtab ()->compunit ().objfile ()->pspace ());
          block = fn_sym->value_block ();
 
          find_label_symbols_in_block (block, name, fn_sym, completion_mode,
@@ -3918,7 +3918,7 @@ decode_digits_list_mode (linespec_state *self, linespec *ls, int line)
       /* The logic above should ensure this.  */
       gdb_assert (elt != NULL);
 
-      program_space *pspace = elt->compunit ()->objfile ()->pspace ();
+      program_space *pspace = elt->compunit ().objfile ()->pspace ();
       set_current_program_space (pspace);
 
       /* Simplistic search just for the list command.  */
@@ -3955,7 +3955,7 @@ decode_digits_ordinary (struct linespec_state *self,
       /* The logic above should ensure this.  */
       gdb_assert (elt != NULL);
 
-      objfile *objfile = elt->compunit ()->objfile ();
+      objfile *objfile = elt->compunit ().objfile ();
       program_space *pspace = objfile->pspace ();
       set_current_program_space (pspace);
 
@@ -4166,7 +4166,7 @@ search_minsyms_for_name (struct collect_info *info,
     }
   else
     {
-      objfile &objfile = *symtab->compunit ()->objfile ();
+      objfile &objfile = *symtab->compunit ().objfile ();
       program_space *pspace = objfile.pspace ();
 
       if (search_pspace == NULL || pspace == search_pspace)
@@ -4264,13 +4264,14 @@ add_matching_symbols_to_info (const char *name,
                                             add_symbol);
          search_minsyms_for_name (info, lookup_name, pspace, NULL);
        }
-      else if (pspace == NULL || pspace == elt->compunit ()->objfile ()->pspace ())
+      else if (pspace == NULL
+              || pspace == elt->compunit ().objfile ()->pspace ())
        {
          int prev_len = info->symbols->size ();
 
          /* Program spaces that are executing startup should have
             been filtered out earlier.  */
-         program_space *elt_pspace = elt->compunit ()->objfile ()->pspace ();
+         program_space *elt_pspace = elt->compunit ().objfile ()->pspace ();
          gdb_assert (!elt_pspace->executing_startup);
          set_current_program_space (elt_pspace);
          iterate_over_file_blocks (elt, lookup_name, SEARCH_VFT, add_symbol);
@@ -4305,7 +4306,7 @@ symbol_to_sal (bool funfirstline, symbol *sym)
          result.symbol = sym;
          result.line = sym->line ();
          result.pc = sym->value_address ();
-         result.pspace = result.symtab->compunit ()->objfile ()->pspace ();
+         result.pspace = result.symtab->compunit ().objfile ()->pspace ();
          result.explicit_pc = 1;
          return result;
        }
@@ -4321,7 +4322,7 @@ symbol_to_sal (bool funfirstline, symbol *sym)
          result.symbol = sym;
          result.line = sym->line ();
          result.pc = sym->value_address ();
-         result.pspace = result.symtab->compunit ()->objfile ()->pspace ();
+         result.pspace = result.symtab->compunit ().objfile ()->pspace ();
          return result;
        }
     }
index 50fc5c796915b274b6d5df4afbc080c75c8a5ad6..6e01301484f0e71fef5ff15ac96b372ff6d969c7 100644 (file)
@@ -44,7 +44,7 @@ sal_macro_scope (struct symtab_and_line sal)
   if (sal.symtab == NULL)
     return result;
 
-  cust = sal.symtab->compunit ();
+  cust = &sal.symtab->compunit ();
   if (cust->macro_table () == NULL)
     return result;
 
index 2ce661ad6d26596497f9015ab5407f48ce28d341..8b2fb379ec85625fc4f2d0735c9fd5af343228d1 100644 (file)
@@ -56,7 +56,7 @@ mi_cmd_file_list_exec_source_file (const char *command,
   uiout->field_string ("fullname", symtab_to_fullname (st.symtab));
 
   uiout->field_signed ("macro-info",
-                      st.symtab->compunit ()->macro_table () != NULL);
+                      st.symtab->compunit ().macro_table () != NULL);
 }
 
 /* Implement -file-list-exec-source-files command.  */
index d7535c51d2a752d1c2762bfc27879b06a6bfc92e..e284fe0172980eb4bf15f09e540ae12e751fa53d 100644 (file)
@@ -50,7 +50,7 @@ mi_cmd_symbol_list_lines (const char *command, const char *const *argv,
      already sorted by increasing values in the symbol table, so no
      need to perform any other sorting.  */
 
-  struct objfile *objfile = s->compunit ()->objfile ();
+  struct objfile *objfile = s->compunit ().objfile ();
   gdbarch = objfile->arch ();
 
   ui_out_emit_list list_emitter (uiout, "lines");
index 387434153e9ae5176e7745e0241764f2f97c6ab9..408ddf1ff830f62f4788be85d4de923a4290c5f4 100644 (file)
@@ -462,7 +462,7 @@ objfile::~objfile ()
      and if so, call clear_last_displayed_sal.  */
   if (symtab *last_displayed_symtab = get_last_displayed_symtab ();
       last_displayed_symtab != nullptr
-      && last_displayed_symtab->compunit ()->objfile () == this)
+      && last_displayed_symtab->compunit ().objfile () == this)
     clear_last_displayed_sal ();
 
   /* Rebuild section map next time we need it.  */
index 32fef65dc3768f63de3fc0de78b564d5ba9b7f53..1351dbe2d0c5da83c153ca6d46ad1322191471b7 100644 (file)
@@ -468,9 +468,8 @@ or1k_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
       if (0 != prologue_end)
        {
          struct symtab_and_line prologue_sal = find_sal_for_pc (start_pc, 0);
-         struct compunit_symtab *compunit
-           = prologue_sal.symtab->compunit ();
-         const char *debug_format = compunit->debugformat ();
+         const char *debug_format
+           = prologue_sal.symtab->compunit ().debugformat ();
 
          if ((NULL != debug_format)
              && (strlen ("dwarf") <= strlen (debug_format))
index c06ada3b7ff8aae834dcc78dccec9fc7f70fd454..1a43837ae3338e379703c40801d6b1b3d8bdfc30 100644 (file)
@@ -615,7 +615,7 @@ block       :       BLOCKNAME
                              struct symtab *tem =
                                  lookup_symtab (current_program_space, copy.c_str ());
                              if (tem)
-                               $$ = (tem->compunit ()->blockvector ()
+                               $$ = (tem->compunit ().blockvector ()
                                      ->static_block ());
                              else
                                error (_("No file or function \"%s\"."),
index fd190d6e15e71a52e85325c917687a5ad3ce7020..ecb3e30c5cb54236ea031deacdd744aceed3a7c0 100644 (file)
@@ -386,7 +386,7 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
 
          if (cursal.symtab)
            expression_context_block
-             = cursal.symtab->compunit ()->blockvector ()->static_block ();
+             = cursal.symtab->compunit ().blockvector ()->static_block ();
 
          if (expression_context_block)
            expression_context_pc = expression_context_block->entry_pc ();
index 1db13af4c12c88077e5e168c757151e535a8973b..faaedc5e9e8f22e058fca8b460a247f1e78ccd63 100644 (file)
@@ -179,7 +179,7 @@ ltpy_get_pcs_for_line (PyObject *self, PyObject *args)
       return gdbpy_handle_gdb_exception (nullptr, except);
     }
 
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
   return build_line_table_tuple_from_entries (objfile, entries);
 }
 
@@ -413,7 +413,7 @@ ltpy_iternext (PyObject *self)
       item = &(symtab->linetable ()->item[iter_obj->current_index]);
     }
 
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
   obj = build_linetable_entry (item->line, item->pc (objfile));
   iter_obj->current_index++;
 
index 9a343167624c40391eebf91f88c7db3316c4c353..ce5feaeb39097868245a35e9f36fe21318bbeecc 100644 (file)
@@ -130,7 +130,7 @@ stpy_get_objfile (PyObject *self, void *closure)
 
   STPY_REQUIRE_VALID (self, symtab);
 
-  return objfile_to_objfile_object (symtab->compunit ()->objfile ()).release ();
+  return objfile_to_objfile_object (symtab->compunit ().objfile ()).release ();
 }
 
 /* Getter function for symtab.producer.  */
@@ -139,13 +139,13 @@ static PyObject *
 stpy_get_producer (PyObject *self, void *closure)
 {
   struct symtab *symtab = NULL;
-  struct compunit_symtab *cust;
 
   STPY_REQUIRE_VALID (self, symtab);
-  cust = symtab->compunit ();
-  if (cust->producer () != nullptr)
+  compunit_symtab &cust = symtab->compunit ();
+
+  if (cust.producer () != nullptr)
     {
-      const char *producer = cust->producer ();
+      const char *producer = cust.producer ();
 
       return host_string_to_python_string (producer).release ();
     }
@@ -191,11 +191,11 @@ stpy_global_block (PyObject *self, PyObject *args)
 
   STPY_REQUIRE_VALID (self, symtab);
 
-  blockvector = symtab->compunit ()->blockvector ();
+  blockvector = symtab->compunit ().blockvector ();
   const struct block *block = blockvector->global_block ();
 
   return block_to_block_object (block,
-                               symtab->compunit ()->objfile ()).release ();
+                               symtab->compunit ().objfile ()).release ();
 }
 
 /* Return the STATIC_BLOCK of the underlying symtab.  */
@@ -208,11 +208,11 @@ stpy_static_block (PyObject *self, PyObject *args)
 
   STPY_REQUIRE_VALID (self, symtab);
 
-  blockvector = symtab->compunit ()->blockvector ();
+  blockvector = symtab->compunit ().blockvector ();
   const struct block *block = blockvector->static_block ();
 
   return block_to_block_object (block,
-                               symtab->compunit ()->objfile ()).release ();
+                               symtab->compunit ().objfile ()).release ();
 }
 
 /* Implementation of gdb.Symtab.linetable (self) -> gdb.LineTable.
@@ -361,7 +361,7 @@ stpy_dealloc (PyObject *obj)
   symtab_object *symtab_obj = (symtab_object *) obj;
 
   if (symtab_obj->symtab != nullptr)
-    stpy_registry.remove (symtab_obj->symtab->compunit ()->objfile(),
+    stpy_registry.remove (symtab_obj->symtab->compunit ().objfile (),
                          symtab_obj);
 
   Py_TYPE (obj)->tp_free (obj);
@@ -438,7 +438,7 @@ salpy_dealloc (PyObject *self)
   sal_object *self_sal = (sal_object *) self;
 
   if (self_sal->sal != nullptr && self_sal->sal->symtab != nullptr)
-    salpy_registry.remove (self_sal->sal->symtab->compunit ()->objfile (),
+    salpy_registry.remove (self_sal->sal->symtab->compunit ().objfile (),
                           self_sal);
 
   xfree (self_sal->sal);
@@ -463,7 +463,7 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
      objfile cleanup observer linked list.  */
   symtab *symtab = sal_obj->sal->symtab;
   if (symtab != nullptr)
-    salpy_registry.add (symtab->compunit ()->objfile (), sal_obj);
+    salpy_registry.add (symtab->compunit ().objfile (), sal_obj);
 }
 
 /* Given a symtab, and a symtab_object that has previously been
@@ -476,7 +476,7 @@ set_symtab (symtab_object *obj, struct symtab *symtab)
 {
   obj->symtab = symtab;
   if (symtab != nullptr)
-    stpy_registry.add (symtab->compunit ()->objfile (), obj);
+    stpy_registry.add (symtab->compunit ().objfile (), obj);
 }
 
 /* Create a new symbol table (gdb.Symtab) object that encapsulates the
@@ -491,7 +491,7 @@ symtab_to_symtab_object (struct symtab *symtab)
   if (symtab != nullptr)
     {
       gdbpy_ref<> result
-       = stpy_registry.lookup (symtab->compunit ()->objfile (), symtab);
+       = stpy_registry.lookup (symtab->compunit ().objfile (), symtab);
       if (result != nullptr)
        return result;
     }
index 4bd755b24f24baed583f9372bb1bf925fa0d13be..dae243ee2dbd51e769fa90029c85a52c1ca5f159 100644 (file)
@@ -729,7 +729,7 @@ btrace_find_line_range (CORE_ADDR pc)
   if (nlines <= 0)
     return btrace_mk_line_range (symtab, 0, 0);
 
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
   unrelocated_addr unrel_pc
     = unrelocated_addr (pc - objfile->text_section_offset ());
 
index 6e8acab3504435c3cf06579e132ccf07d07922f2..804a6a08a8c3547d9fe4bcb42a3cc1f9f915f82d 100644 (file)
@@ -110,9 +110,9 @@ source_cache::get_plain_source_lines (struct symtab *s,
     perror_with_name (symtab_to_filename_for_display (s));
 
   time_t mtime = 0;
-  if (s->compunit ()->objfile () != NULL
-      && s->compunit ()->objfile ()->obfd != NULL)
-    mtime = s->compunit ()->objfile ()->mtime;
+  if (s->compunit ().objfile () != NULL
+      && s->compunit ().objfile ()->obfd != NULL)
+    mtime = s->compunit ().objfile ()->mtime;
   else if (current_program_space->exec_bfd ())
     mtime = current_program_space->ebfd_mtime;
 
index 6028c29deae6985eeff3b43cb04f043a002661eb..5c7c344a1aab0226aedfbcd619680748801627af 100644 (file)
@@ -299,7 +299,7 @@ clear_current_source_symtab_and_line (objfile *objfile)
     return;
 
   if (loc->symtab () != nullptr
-      && loc->symtab ()->compunit ()->objfile () == objfile)
+      && loc->symtab ()->compunit ().objfile () == objfile)
     clear_current_source_symtab_and_line (objfile->pspace ());
 }
 
@@ -671,7 +671,6 @@ info_source_command (const char *ignore, int from_tty)
   current_source_location *loc
     = get_source_location (current_program_space);
   struct symtab *s = loc->symtab ();
-  struct compunit_symtab *cust;
 
   if (!s)
     {
@@ -679,10 +678,11 @@ info_source_command (const char *ignore, int from_tty)
       return;
     }
 
-  cust = s->compunit ();
+  compunit_symtab &cust = s->compunit ();
+
   gdb_printf (_("Current source file is %s\n"), s->filename ());
-  if (s->compunit ()->dirname () != NULL)
-    gdb_printf (_("Compilation directory is %s\n"), s->compunit ()->dirname ());
+  if (s->compunit ().dirname () != NULL)
+    gdb_printf (_("Compilation directory is %s\n"), s->compunit ().dirname ());
   if (s->fullname () != nullptr)
     gdb_printf (_("Located in %s\n"), s->fullname ());
   if (std::optional<int> last_lineno = last_symtab_line (s);
@@ -693,12 +693,12 @@ info_source_command (const char *ignore, int from_tty)
   gdb_printf (_("Source language is %s.\n"),
              language_str (s->language ()));
   gdb_printf (_("Producer is %s.\n"),
-             (cust->producer ()) != nullptr
-             ? cust->producer () : _("unknown"));
+             (cust.producer ()) != nullptr
+             ? cust.producer () : _("unknown"));
   gdb_printf (_("Compiled with %s debugging format.\n"),
-             cust->debugformat ());
+             cust.debugformat ());
   gdb_printf (_("%s preprocessor macro info.\n"),
-             (cust->macro_table () != nullptr
+             (cust.macro_table () != nullptr
               ? "Includes" : "Does not include"));
 }
 \f
@@ -1117,44 +1117,41 @@ open_source_file (struct symtab *s)
 
   gdb::unique_xmalloc_ptr<char> fullname = s->release_fullname ();
   scoped_fd fd = find_and_open_source (s->filename (),
-                                      s->compunit ()->dirname (),
+                                      s->compunit ().dirname (),
                                       &fullname);
 
   if (fd.get () < 0)
     {
-      if (s->compunit () != nullptr)
+      const objfile *ofp = s->compunit ().objfile ();
+
+      std::string srcpath;
+      if (IS_ABSOLUTE_PATH (s->filename ()))
+       srcpath = s->filename ();
+      else if (s->compunit ().dirname () != nullptr)
        {
-         const objfile *ofp = s->compunit ()->objfile ();
+         srcpath = s->compunit ().dirname ();
+         srcpath += SLASH_STRING;
+         srcpath += s->filename ();
+       }
 
-         std::string srcpath;
-         if (IS_ABSOLUTE_PATH (s->filename ()))
-           srcpath = s->filename ();
-         else if (s->compunit ()->dirname () != nullptr)
-           {
-             srcpath = s->compunit ()->dirname ();
-             srcpath += SLASH_STRING;
-             srcpath += s->filename ();
-           }
+      const struct bfd_build_id *build_id
+       = build_id_bfd_get (ofp->obfd.get ());
 
-         const struct bfd_build_id *build_id
-           = build_id_bfd_get (ofp->obfd.get ());
+      /* Query debuginfod for the source file.  */
+      if (build_id != nullptr && !srcpath.empty ())
+       {
+         scoped_fd query_fd
+           = debuginfod_source_query (build_id->data,
+                                      build_id->size,
+                                      srcpath.c_str (),
+                                      &fullname);
 
-         /* Query debuginfod for the source file.  */
-         if (build_id != nullptr && !srcpath.empty ())
+         /* Don't return a negative errno from debuginfod_source_query.
+            It handles the reporting of its own errors.  */
+         if (query_fd.get () >= 0)
            {
-             scoped_fd query_fd
-               = debuginfod_source_query (build_id->data,
-                                          build_id->size,
-                                          srcpath.c_str (),
-                                          &fullname);
-
-             /* Don't return a negative errno from debuginfod_source_query.
-                It handles the reporting of its own errors.  */
-             if (query_fd.get () >= 0)
-               {
-                 s->set_fullname (std::move (fullname));
-                 return query_fd;
-               }
+             s->set_fullname (std::move (fullname));
+             return query_fd;
            }
        }
     }
@@ -1217,11 +1214,11 @@ symtab_to_fullname (struct symtab *s)
          /* rewrite_source_path would be applied by find_and_open_source, we
             should report the pathname where GDB tried to find the file.  */
 
-         if (s->compunit ()->dirname () == nullptr
+         if (s->compunit ().dirname () == nullptr
              || IS_ABSOLUTE_PATH (s->filename ()))
            fullname = make_unique_xstrdup (s->filename ());
          else
-           fullname.reset (concat (s->compunit ()->dirname (), SLASH_STRING,
+           fullname.reset (concat (s->compunit ().dirname (), SLASH_STRING,
                                    s->filename (), (char *) NULL));
 
          s->set_fullname (rewrite_source_path (fullname.get ()));
@@ -1527,7 +1524,7 @@ info_line_command (const char *arg, int from_tty)
       else if (sal.line > 0
               && find_pc_range_for_sal (sal, &start_pc, &end_pc))
        {
-         gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
+         gdbarch *gdbarch = sal.symtab->compunit ().objfile ()->arch ();
 
          if (start_pc == end_pc)
            {
index 5f046a03567eccbddeb9859b088496c3e2698037..296795bda808f19cfb0bcd25b561b4cb8a413f8a 100644 (file)
@@ -2811,7 +2811,7 @@ allocate_symtab (struct compunit_symtab *cust, const char *filename,
   struct objfile *objfile = cust->objfile ();
   struct symtab *symtab
     = obstack_new<struct symtab> (&objfile->objfile_obstack,
-                                 cust,
+                                 *cust,
                                  objfile->intern (filename),
                                  objfile->intern (filename_for_id),
                                  deduce_language_from_filename (filename));
index 89374bd8a2ffe256249caedd91e84c631bded4c7..6d90765fe50b6e9b5011ee3b52c84567e9f0e913 100644 (file)
@@ -135,7 +135,7 @@ dump_objfile (struct objfile *objfile)
                      styled_string (file_name_style.style (),
                                     symtab_to_filename_for_display (symtab)),
                      host_address_to_string (symtab));
-         if (symtab->compunit ()->objfile () != objfile)
+         if (symtab->compunit ().objfile () != objfile)
            gdb_printf (_(", NOT ON CHAIN!"));
          gdb_printf ("\n");
        }
@@ -244,7 +244,7 @@ dump_msymbols (struct objfile *objfile, struct ui_file *outfile)
 static void
 dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
 {
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
   struct gdbarch *gdbarch = objfile->arch ();
   const struct linetable *l;
   int depth;
@@ -254,10 +254,10 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
                             symtab_to_filename_for_display (symtab)),
              host_address_to_string (symtab));
 
-  if (symtab->compunit ()->dirname () != NULL)
+  if (symtab->compunit ().dirname () != NULL)
     gdb_printf (outfile, _("Compilation directory is %ps\n"),
                styled_string (file_name_style.style (),
-                              symtab->compunit ()->dirname ()));
+                              symtab->compunit ().dirname ()));
   gdb_printf (outfile, _("Read from object file %ps (%s)\n"),
              styled_string (file_name_style.style (),
                             objfile_name (objfile)),
@@ -288,7 +288,7 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
   if (is_main_symtab_of_compunit_symtab (symtab))
     {
       gdb_printf (outfile, _("\nBlockvector:\n\n"));
-      const blockvector *bv = symtab->compunit ()->blockvector ();
+      const blockvector *bv = symtab->compunit ().blockvector ();
       for (int i = 0; i < bv->num_blocks (); i++)
        {
          const block *b = bv->block (i);
@@ -342,9 +342,9 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
     }
   else
     {
-      compunit_symtab *compunit = symtab->compunit ();
+      compunit_symtab &compunit = symtab->compunit ();
       const char *compunit_filename
-       = symtab_to_filename_for_display (compunit->primary_filetab ());
+       = symtab_to_filename_for_display (compunit.primary_filetab ());
 
       gdb_printf (outfile,
                  _("\nBlockvector same as owning compunit: %ps\n\n"),
@@ -356,14 +356,14 @@ dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
      compunit_symtabs included by this one. */
   if (is_main_symtab_of_compunit_symtab (symtab))
     {
-      struct compunit_symtab *cust = symtab->compunit ();
+      compunit_symtab &cust = symtab->compunit ();
 
-      if (cust->user != nullptr)
+      if (cust.user != nullptr)
        gdb_printf (outfile, _("Compunit user: %s\n"),
-                   host_address_to_string (cust->user->primary_filetab ()));
+                   host_address_to_string (cust.user->primary_filetab ()));
 
 
-      for (compunit_symtab *include : cust->includes)
+      for (compunit_symtab *include : cust.includes)
        gdb_printf (outfile, _("Compunit include: %s\n"),
                    host_address_to_string (include->primary_filetab ()));
     }
@@ -978,14 +978,14 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
   const struct linetable *linetable;
   struct objfile *objfile;
 
-  objfile = symtab->compunit ()->objfile ();
+  objfile = symtab->compunit ().objfile ();
   gdb_printf (_("objfile: %ps ((struct objfile *) %s)\n"),
              styled_string (file_name_style.style (),
                             objfile_name (objfile)),
              host_address_to_string (objfile));
   gdb_printf (_("compunit_symtab: %s ((struct compunit_symtab *) %s)\n"),
-             symtab->compunit ()->name,
-             host_address_to_string (symtab->compunit ()));
+             symtab->compunit ().name,
+             host_address_to_string (&symtab->compunit ()));
   gdb_printf (_("symtab: %ps ((struct symtab *) %s)\n"),
              styled_string (file_name_style.style (),
                             symtab_to_fullname (symtab)),
index b38362e6fccebfee56fbf6fb2b356679c9fc7f9c..4ca6f92ff9a030b7a6741d397e9513cc7a798087 100644 (file)
@@ -3389,7 +3389,7 @@ find_pc_for_line (struct symtab *symtab, int line, CORE_ADDR *pc)
   if (symtab != NULL)
     {
       l = symtab->linetable ();
-      *pc = l->item[ind].pc (symtab->compunit ()->objfile ());
+      *pc = l->item[ind].pc (symtab->compunit ().objfile ());
       return true;
     }
   else
@@ -3511,10 +3511,10 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
   symtab_and_line sal = find_sal_for_pc_sect (func_addr, section, 0);
 
   if (funfirstline && sal.symtab != NULL
-      && (sal.symtab->compunit ()->locations_valid ()
+      && (sal.symtab->compunit ().locations_valid ()
          || sal.symtab->language () == language_asm))
     {
-      struct gdbarch *gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
+      struct gdbarch *gdbarch = sal.symtab->compunit ().objfile ()->arch ();
 
       sal.pc = func_addr;
       if (gdbarch_skip_entrypoint_p (gdbarch))
@@ -3592,7 +3592,7 @@ skip_prologue_using_lineinfo (CORE_ADDR func_addr, struct symtab *symtab)
   if (!find_pc_partial_function (func_addr, NULL, &func_start, &func_end))
     return func_addr;
 
-  struct objfile *objfile = symtab->compunit ()->objfile ();
+  struct objfile *objfile = symtab->compunit ().objfile ();
 
   /* Linetable entries are ordered by PC values, see the commentary in
      symtab.h where `struct linetable' is defined.  Thus, the first
@@ -3634,7 +3634,7 @@ skip_prologue_using_linetable (CORE_ADDR func_addr)
     {
       const linetable *linetable = prologue_sal.symtab->linetable ();
 
-      struct objfile *objfile = prologue_sal.symtab->compunit ()->objfile ();
+      struct objfile *objfile = prologue_sal.symtab->compunit ().objfile ();
 
       unrelocated_addr unrel_start
        = unrelocated_addr (start_pc - objfile->text_section_offset ());
@@ -3727,7 +3727,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
      have proven the CU (Compilation Unit) supports it.  sal->SYMTAB does not
      have to be set by the caller so we use SYM instead.  */
   if (sym != NULL
-      && sym->symtab ()->compunit ()->locations_valid ())
+      && sym->symtab ()->compunit ().locations_valid ())
     force_skip = 0;
 
   symtab_and_line start_sal;
@@ -3885,7 +3885,7 @@ skip_prologue_using_sal (struct gdbarch *gdbarch, CORE_ADDR func_addr)
       if (prologue_sal.symtab->language () != language_asm)
        {
          struct objfile *objfile
-           = prologue_sal.symtab->compunit ()->objfile ();
+           = prologue_sal.symtab->compunit ().objfile ();
          const linetable *linetable = prologue_sal.symtab->linetable ();
          gdb_assert (linetable->nitems > 0);
          int idx = 0;
@@ -3986,7 +3986,7 @@ find_epilogue_using_linetable (CORE_ADDR func_addr)
   const struct symtab_and_line sal = find_sal_for_pc (end_pc - 1, 0);
   if (sal.symtab != nullptr && sal.symtab->language () != language_asm)
     {
-      struct objfile *objfile = sal.symtab->compunit ()->objfile ();
+      struct objfile *objfile = sal.symtab->compunit ().objfile ();
       unrelocated_addr unrel_start
        = unrelocated_addr (start_pc - objfile->text_section_offset ());
       unrelocated_addr unrel_end
@@ -6155,7 +6155,7 @@ collect_file_symbol_completion_matches (completion_tracker &tracker,
      for symbols which match.  */
   for_each_symtab (current_program_space, srcfile, [&] (symtab *s)
     {
-      add_symtab_completions (s->compunit (),
+      add_symtab_completions (&s->compunit (),
                              tracker, mode, lookup_name,
                              sym_text, word, TYPE_CODE_UNDEF);
     });
@@ -6560,7 +6560,7 @@ struct objfile *
 symbol::objfile () const
 {
   gdb_assert (is_objfile_owned ());
-  return owner.symtab->compunit ()->objfile ();
+  return owner.symtab->compunit ().objfile ();
 }
 
 /* See symtab.h.  */
@@ -6570,7 +6570,7 @@ symbol::arch () const
 {
   if (!is_objfile_owned ())
     return owner.arch;
-  return owner.symtab->compunit ()->objfile ()->arch ();
+  return owner.symtab->compunit ().objfile ()->arch ();
 }
 
 /* See symtab.h.  */
index b29b72aba00d4b873aae2dcc999c515903d1ae8e..fc2c1ed23aab1322ac5665c89a6be9581acd6521 100644 (file)
@@ -1671,21 +1671,20 @@ struct linetable
 
 struct symtab
 {
-  symtab (struct compunit_symtab *cust, const char *filename,
+  symtab (struct compunit_symtab &cust, const char *filename,
          const char *filename_for_id, enum language language)
     : m_filename (filename),
       m_filename_for_id (filename_for_id),
-      m_compunit (cust),
+      m_compunit (&cust),
       m_language (language)
   {
     gdb_assert (m_filename != nullptr);
     gdb_assert (m_filename_for_id != nullptr);
-    gdb_assert (m_compunit != nullptr);
   }
 
-  struct compunit_symtab *compunit () const
+  struct compunit_symtab &compunit () const
   {
-    return m_compunit;
+    return *m_compunit;
   }
 
   const struct linetable *linetable () const
@@ -2028,7 +2027,7 @@ struct compunit_symtab : intrusive_list_node<compunit_symtab>
 static inline bool
 is_main_symtab_of_compunit_symtab (struct symtab *symtab)
 {
-  return symtab == symtab->compunit ()->primary_filetab ();
+  return symtab == symtab->compunit ().primary_filetab ();
 }
 
 /* Return true if epilogue unwind info of CUST is valid.  */
index 783d4b2a1c24182e43ea6b113f3f1970a7c2cb7c..466e9972106dcee6a0c9b14b18eaeb9e4cb80e9c 100644 (file)
@@ -79,7 +79,7 @@ tui_source_window::set_contents (struct gdbarch *arch,
   m_fullname = make_unique_xstrdup (symtab_to_fullname (s));
 
   cur_line = 0;
-  m_gdbarch = s->compunit ()->objfile ()->arch ();
+  m_gdbarch = s->compunit ().objfile ()->arch ();
   m_start_line_or_addr.loa = LOA_LINE;
   cur_line_no = m_start_line_or_addr.u.line_no = line_no;
 
index 8609a7cd4fe25524462bf4fed290524d9439f2b2..e3f64892e27198d9ce699e420d58244422ef3e20 100644 (file)
@@ -209,7 +209,7 @@ tui_update_source_windows_with_line (struct symtab_and_line sal)
   if (sal.symtab != nullptr)
     {
       find_pc_for_line (sal.symtab, sal.line, &sal.pc);
-      gdbarch = sal.symtab->compunit ()->objfile ()->arch ();
+      gdbarch = sal.symtab->compunit ().objfile ()->arch ();
     }
 
   for (struct tui_source_window_base *win_info : tui_source_windows ())
index 9da18855d7106a1fbbbba2ae8d11fd32d84a5ab6..7359f9bcfb6de23a664bb0e364a00ea3aee711e3 100644 (file)
@@ -498,8 +498,8 @@ z80_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
 
       if (prologue_sal.symtab != nullptr)
        {
-         struct compunit_symtab *compunit = prologue_sal.symtab->compunit ();
-         const char *debug_format = compunit->debugformat ();
+         const char *debug_format
+           = prologue_sal.symtab->compunit ().debugformat ();
 
          if (debug_format != nullptr
              && !strncasecmp ("dwarf", debug_format, strlen ("dwarf")))