Remove the macro, replace with an equivalent method.
Change-Id: I8f9ecd290ad28502e53c1ceca5006ba78bf042eb
re_comp (known_runtime_file_name_patterns[i]);
if (re_exec (lbasename (sal.symtab->filename)))
return 1;
- if (SYMTAB_OBJFILE (sal.symtab) != NULL
- && re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab))))
+ if (sal.symtab->objfile () != NULL
+ && re_exec (objfile_name (sal.symtab->objfile ())))
return 1;
}
return false;
annotate_source (s->fullname, line, (int) (*offsets)[line - 1],
- mid_statement, SYMTAB_OBJFILE (s)->arch (),
+ mid_statement, s->objfile ()->arch (),
pc);
/* Update the current symtab and line. */
if (sal.section)
return sal.section->objfile->arch ();
if (sal.symtab)
- return SYMTAB_OBJFILE (sal.symtab)->arch ();
+ return sal.symtab->objfile ()->arch ();
return NULL;
}
sym = block_linkage_function (b);
if (sym != NULL)
{
- fixup_symbol_section (sym, SYMTAB_OBJFILE (sal->symtab));
- sal->section = sym->obj_section (SYMTAB_OBJFILE (sal->symtab));
+ fixup_symbol_section (sym, sal->symtab->objfile ());
+ sal->section = sym->obj_section (sal->symtab->objfile ());
}
else
{
breakpoint_free_objfile (struct objfile *objfile)
{
for (bp_location *loc : all_bp_locations ())
- if (loc->symtab != NULL && SYMTAB_OBJFILE (loc->symtab) == objfile)
+ if (loc->symtab != NULL && loc->symtab->objfile () == objfile)
loc->symtab = NULL;
}
error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
- gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
+ gdbarch = sal.symtab->objfile ()->arch ();
sym = find_pc_function (sal.pc);
if (sym)
printf_filtered ("%s is in %s (%s:%d).\n",
error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
- gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
+ gdbarch = sal.symtab->objfile ()->arch ();
sym = find_pc_function (sal.pc);
if (sym)
printf_filtered ("%s is in %s (%s:%d).\n",
static htab_t
stscm_objfile_symtab_map (struct symtab *symtab)
{
- struct objfile *objfile = SYMTAB_OBJFILE (symtab);
+ struct objfile *objfile = symtab->objfile ();
htab_t htab = (htab_t) objfile_data (objfile, stscm_objfile_data_key);
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_OBJFILE (symtab));
+ return ofscm_scm_from_objfile (symtab->objfile ());
}
/* (symtab-global-block <gdb:symtab>) -> <gdb:block>
blockvector = symtab->blockvector ();
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
- return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
+ return bkscm_scm_from_block (block, symtab->objfile ());
}
/* (symtab-static-block <gdb:symtab>) -> <gdb:block>
blockvector = symtab->blockvector ();
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
- return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
+ return bkscm_scm_from_block (block, symtab->objfile ());
}
\f
/* Administrivia for sal (symtab-and-line) smobs. */
{
set_current_program_space (SYMTAB_PSPACE (symtab));
iterate_over_minimal_symbols
- (SYMTAB_OBJFILE (symtab), name,
+ (symtab->objfile (), name,
[&] (struct minimal_symbol *msym)
{
- add_minsym (msym, SYMTAB_OBJFILE (symtab), symtab,
+ add_minsym (msym, symtab->objfile (), symtab,
info->state->list_mode, &minsyms);
return false;
});
already sorted by increasing values in the symbol table, so no
need to perform any other sorting. */
- gdbarch = SYMTAB_OBJFILE (s)->arch ();
+ gdbarch = s->objfile ()->arch ();
ui_out_emit_list list_emitter (uiout, "lines");
if (s->linetable () != NULL && s->linetable ()->nitems > 0)
{
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
- if (cursal.symtab && SYMTAB_OBJFILE (cursal.symtab) == this)
+ if (cursal.symtab && cursal.symtab->objfile () == this)
clear_current_source_symtab_and_line ();
}
STPY_REQUIRE_VALID (self, symtab);
- return objfile_to_objfile_object (SYMTAB_OBJFILE (symtab)).release ();
+ return objfile_to_objfile_object (symtab->objfile ()).release ();
}
/* Getter function for symtab.producer. */
blockvector = symtab->blockvector ();
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
- return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
+ return block_to_block_object (block, symtab->objfile ());
}
/* Return the STATIC_BLOCK of the underlying symtab. */
blockvector = symtab->blockvector ();
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
- return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
+ return block_to_block_object (block, symtab->objfile ());
}
/* Implementation of gdb.Symtab.linetable (self) -> gdb.LineTable.
symtab->prev->next = symtab->next;
else if (symtab->symtab)
{
- set_objfile_data (SYMTAB_OBJFILE (symtab->symtab),
+ set_objfile_data (symtab->symtab->objfile (),
stpy_objfile_data_key, symtab->next);
}
if (symtab->next)
self_sal->prev->next = self_sal->next;
else if (self_sal->symtab != Py_None)
set_objfile_data
- (SYMTAB_OBJFILE (symtab_object_to_symtab (self_sal->symtab)),
+ (symtab_object_to_symtab (self_sal->symtab)->objfile (),
salpy_objfile_data_key, self_sal->next);
if (self_sal->next)
symtab *symtab = symtab_object_to_symtab (sal_obj->symtab);
sal_obj->next
- = ((sal_object *) objfile_data (SYMTAB_OBJFILE (symtab),
+ = ((sal_object *) objfile_data (symtab->objfile (),
salpy_objfile_data_key));
if (sal_obj->next)
sal_obj->next->prev = sal_obj;
- set_objfile_data (SYMTAB_OBJFILE (symtab),
+ set_objfile_data (symtab->objfile (),
salpy_objfile_data_key, sal_obj);
}
else
{
obj->next
= ((symtab_object *)
- objfile_data (SYMTAB_OBJFILE (symtab), stpy_objfile_data_key));
+ objfile_data (symtab->objfile (), stpy_objfile_data_key));
if (obj->next)
obj->next->prev = obj;
- set_objfile_data (SYMTAB_OBJFILE (symtab), stpy_objfile_data_key, obj);
+ set_objfile_data (symtab->objfile (), stpy_objfile_data_key, obj);
}
else
obj->next = NULL;
perror_with_name (symtab_to_filename_for_display (s));
time_t mtime = 0;
- if (SYMTAB_OBJFILE (s) != NULL && SYMTAB_OBJFILE (s)->obfd != NULL)
- mtime = SYMTAB_OBJFILE (s)->mtime;
+ if (s->objfile () != NULL && s->objfile ()->obfd != NULL)
+ mtime = s->objfile ()->mtime;
else if (current_program_space->exec_bfd ())
mtime = current_program_space->ebfd_mtime;
else if (sal.line > 0
&& find_line_pc_range (sal, &start_pc, &end_pc))
{
- struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
+ struct gdbarch *gdbarch = sal.symtab->objfile ()->arch ();
if (start_pc == end_pc)
{
printf_filtered ("%s at %s",
symtab_to_filename_for_display (symtab),
host_address_to_string (symtab));
- if (SYMTAB_OBJFILE (symtab) != objfile)
+ if (symtab->objfile () != objfile)
printf_filtered (", NOT ON CHAIN!");
printf_filtered ("\n");
}
static void
dump_symtab_1 (struct symtab *symtab, struct ui_file *outfile)
{
- struct objfile *objfile = SYMTAB_OBJFILE (symtab);
+ struct objfile *objfile = symtab->objfile ();
struct gdbarch *gdbarch = objfile->arch ();
int i;
struct mdict_iterator miter;
&& (sal.symtab->compunit ()->locations_valid ()
|| sal.symtab->language () == language_asm))
{
- struct gdbarch *gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
+ struct gdbarch *gdbarch = sal.symtab->objfile ()->arch ();
sal.pc = func_addr;
if (gdbarch_skip_entrypoint_p (gdbarch))
symbol_objfile (const struct symbol *symbol)
{
gdb_assert (SYMBOL_OBJFILE_OWNED (symbol));
- return SYMTAB_OBJFILE (symbol->owner.symtab);
+ return symbol->owner.symtab->objfile ();
}
/* See symtab.h. */
{
if (!SYMBOL_OBJFILE_OWNED (symbol))
return symbol->owner.arch;
- return SYMTAB_OBJFILE (symbol->owner.symtab)->arch ();
+ return symbol->owner.symtab->objfile ()->arch ();
}
/* See symtab.h. */
const struct blockvector *blockvector () const;
+ struct objfile *objfile () const;
+
/* Unordered chain of all filetabs in the compunit, with the exception
that the "main" source file is the first entry in the list. */
using symtab_range = next_range<symtab>;
-#define SYMTAB_OBJFILE(symtab) \
- (symtab->compunit ()->objfile ())
-#define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
+#define SYMTAB_PSPACE(symtab) ((symtab)->objfile ()->pspace)
#define SYMTAB_DIRNAME(symtab) ((symtab)->compunit ()->dirname ())
/* Compunit symtabs contain the actual "symbol table", aka blockvector, as well
return this->compunit ()->blockvector ();
}
+inline struct objfile *
+symtab::objfile () const
+{
+ return this->compunit ()->objfile ();
+}
+
/* Return the language of CUST. */
extern enum language compunit_language (const struct compunit_symtab *cust);
m_fullname = make_unique_xstrdup (symtab_to_fullname (s));
cur_line = 0;
- m_gdbarch = SYMTAB_OBJFILE (s)->arch ();
+ m_gdbarch = s->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_line_pc (sal.symtab, sal.line, &sal.pc);
- gdbarch = SYMTAB_OBJFILE (sal.symtab)->arch ();
+ gdbarch = sal.symtab->objfile ()->arch ();
}
for (struct tui_source_window_base *win_info : tui_source_windows ())