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)
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;
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;
}
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;
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);
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;
}
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
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;
symtab != nullptr)
{
yylval.bval
- = symtab->compunit ()->blockvector ()->static_block ();
+ = symtab->compunit ().blockvector ()->static_block ();
return FILENAME;
}
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",
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",
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)
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;
= 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 ();
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 ());
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 ());
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)
= 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>
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>
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. */
{
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++)
{
{
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);
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);
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
{
/* 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);
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)
/* 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 ());
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. */
{
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,
/* 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. */
/* 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);
}
else
{
- objfile &objfile = *symtab->compunit ()->objfile ();
+ objfile &objfile = *symtab->compunit ().objfile ();
program_space *pspace = objfile.pspace ();
if (search_pspace == NULL || pspace == search_pspace)
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);
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;
}
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;
}
}
if (sal.symtab == NULL)
return result;
- cust = sal.symtab->compunit ();
+ cust = &sal.symtab->compunit ();
if (cust->macro_table () == NULL)
return result;
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. */
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");
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. */
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))
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\"."),
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 ();
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);
}
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++;
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. */
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 ();
}
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. */
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.
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);
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);
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
{
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
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;
}
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 ());
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;
return;
if (loc->symtab () != nullptr
- && loc->symtab ()->compunit ()->objfile () == objfile)
+ && loc->symtab ()->compunit ().objfile () == objfile)
clear_current_source_symtab_and_line (objfile->pspace ());
}
current_source_location *loc
= get_source_location (current_program_space);
struct symtab *s = loc->symtab ();
- struct compunit_symtab *cust;
if (!s)
{
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);
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
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;
}
}
}
/* 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 ()));
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)
{
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));
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");
}
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;
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)),
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);
}
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"),
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 ()));
}
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)),
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
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))
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
{
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 ());
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;
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;
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
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);
});
symbol::objfile () const
{
gdb_assert (is_objfile_owned ());
- return owner.symtab->compunit ()->objfile ();
+ return owner.symtab->compunit ().objfile ();
}
/* See symtab.h. */
{
if (!is_objfile_owned ())
return owner.arch;
- return owner.symtab->compunit ()->objfile ()->arch ();
+ return owner.symtab->compunit ().objfile ()->arch ();
}
/* See symtab.h. */
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
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. */
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;
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 ())
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")))