gdb: remove SYMTAB_OBJFILE macro
Remove the macro, replace with an equivalent method. Change-Id: I8f9ecd290ad28502e53c1ceca5006ba78bf042eb
This commit is contained in:
parent
012cfab919
commit
652099717d
@ -11388,8 +11388,8 @@ is_known_support_routine (struct frame_info *frame)
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -448,7 +448,7 @@ annotate_source_line (struct symtab *s, int line, int mid_statement,
|
||||
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. */
|
||||
|
@ -7194,7 +7194,7 @@ get_sal_arch (struct symtab_and_line sal)
|
||||
if (sal.section)
|
||||
return sal.section->objfile->arch ();
|
||||
if (sal.symtab)
|
||||
return SYMTAB_OBJFILE (sal.symtab)->arch ();
|
||||
return sal.symtab->objfile ()->arch ();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@ -9236,8 +9236,8 @@ resolve_sal_pc (struct symtab_and_line *sal)
|
||||
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
|
||||
{
|
||||
@ -14736,7 +14736,7 @@ void
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1003,7 +1003,7 @@ edit_command (const char *arg, int from_tty)
|
||||
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",
|
||||
@ -1342,7 +1342,7 @@ list_command (const char *arg, int from_tty)
|
||||
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",
|
||||
|
@ -109,7 +109,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_OBJFILE (symtab);
|
||||
struct objfile *objfile = symtab->objfile ();
|
||||
htab_t htab = (htab_t) objfile_data (objfile, stscm_objfile_data_key);
|
||||
|
||||
if (htab == NULL)
|
||||
@ -348,7 +348,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_OBJFILE (symtab));
|
||||
return ofscm_scm_from_objfile (symtab->objfile ());
|
||||
}
|
||||
|
||||
/* (symtab-global-block <gdb:symtab>) -> <gdb:block>
|
||||
@ -366,7 +366,7 @@ gdbscm_symtab_global_block (SCM self)
|
||||
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>
|
||||
@ -384,7 +384,7 @@ gdbscm_symtab_static_block (SCM self)
|
||||
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 ());
|
||||
}
|
||||
|
||||
/* Administrivia for sal (symtab-and-line) smobs. */
|
||||
|
@ -4323,10 +4323,10 @@ search_minsyms_for_name (struct collect_info *info,
|
||||
{
|
||||
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;
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ mi_cmd_symbol_list_lines (const char *command, char **argv, int argc)
|
||||
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)
|
||||
|
@ -591,7 +591,7 @@ objfile::~objfile ()
|
||||
{
|
||||
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 ();
|
||||
}
|
||||
|
||||
|
@ -119,7 +119,7 @@ stpy_get_objfile (PyObject *self, void *closure)
|
||||
|
||||
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. */
|
||||
@ -183,7 +183,7 @@ stpy_global_block (PyObject *self, PyObject *args)
|
||||
|
||||
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. */
|
||||
@ -199,7 +199,7 @@ stpy_static_block (PyObject *self, PyObject *args)
|
||||
|
||||
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.
|
||||
@ -247,7 +247,7 @@ stpy_dealloc (PyObject *obj)
|
||||
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)
|
||||
@ -330,7 +330,7 @@ salpy_dealloc (PyObject *self)
|
||||
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)
|
||||
@ -378,12 +378,12 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
|
||||
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
|
||||
@ -406,10 +406,10 @@ set_symtab (symtab_object *obj, struct symtab *symtab)
|
||||
{
|
||||
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;
|
||||
|
@ -107,8 +107,8 @@ source_cache::get_plain_source_lines (struct symtab *s,
|
||||
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;
|
||||
|
||||
|
@ -1559,7 +1559,7 @@ info_line_command (const char *arg, int from_tty)
|
||||
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)
|
||||
{
|
||||
|
@ -131,7 +131,7 @@ dump_objfile (struct objfile *objfile)
|
||||
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");
|
||||
}
|
||||
@ -234,7 +234,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_OBJFILE (symtab);
|
||||
struct objfile *objfile = symtab->objfile ();
|
||||
struct gdbarch *gdbarch = objfile->arch ();
|
||||
int i;
|
||||
struct mdict_iterator miter;
|
||||
|
@ -3712,7 +3712,7 @@ find_function_start_sal_1 (CORE_ADDR func_addr, obj_section *section,
|
||||
&& (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))
|
||||
@ -6527,7 +6527,7 @@ struct objfile *
|
||||
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. */
|
||||
@ -6537,7 +6537,7 @@ symbol_arch (const struct symbol *symbol)
|
||||
{
|
||||
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. */
|
||||
|
12
gdb/symtab.h
12
gdb/symtab.h
@ -1405,6 +1405,8 @@ struct symtab
|
||||
|
||||
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. */
|
||||
|
||||
@ -1437,9 +1439,7 @@ struct symtab
|
||||
|
||||
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
|
||||
@ -1689,6 +1689,12 @@ symtab::blockvector () const
|
||||
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);
|
||||
|
@ -70,7 +70,7 @@ tui_source_window::set_contents (struct gdbarch *arch,
|
||||
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;
|
||||
|
||||
|
@ -199,7 +199,7 @@ tui_update_source_windows_with_line (struct symtab_and_line sal)
|
||||
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 ())
|
||||
|
Loading…
x
Reference in New Issue
Block a user