SYMTAB_OBJFILE: New macro.
gdb/ChangeLog: * symtab.h (SYMTAB_OBJFILE): New macro. All uses of member symtab.objfile updated to use it.
This commit is contained in:
parent
98387a2917
commit
eb822aa6d0
19 changed files with 52 additions and 43 deletions
|
@ -1,3 +1,8 @@
|
|||
2014-11-18 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* symtab.h (SYMTAB_OBJFILE): New macro. All uses of member
|
||||
symtab.objfile updated to use it.
|
||||
|
||||
2014-11-18 Doug Evans <xdje42@gmail.com>
|
||||
|
||||
* buildsym.c (watch_main_source_file_lossage): Fix memory leak.
|
||||
|
|
|
@ -11524,8 +11524,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 (sal.symtab->objfile != NULL
|
||||
&& re_exec (objfile_name (sal.symtab->objfile)))
|
||||
if (SYMTAB_OBJFILE (sal.symtab) != NULL
|
||||
&& re_exec (objfile_name (SYMTAB_OBJFILE (sal.symtab))))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -7314,7 +7314,7 @@ get_sal_arch (struct symtab_and_line sal)
|
|||
if (sal.section)
|
||||
return get_objfile_arch (sal.section->objfile);
|
||||
if (sal.symtab)
|
||||
return get_objfile_arch (sal.symtab->objfile);
|
||||
return get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -10210,8 +10210,9 @@ resolve_sal_pc (struct symtab_and_line *sal)
|
|||
sym = block_linkage_function (b);
|
||||
if (sym != NULL)
|
||||
{
|
||||
fixup_symbol_section (sym, sal->symtab->objfile);
|
||||
sal->section = SYMBOL_OBJ_SECTION (sal->symtab->objfile, sym);
|
||||
fixup_symbol_section (sym, SYMTAB_OBJFILE (sal->symtab));
|
||||
sal->section = SYMBOL_OBJ_SECTION (SYMTAB_OBJFILE (sal->symtab),
|
||||
sym);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -16050,7 +16051,7 @@ breakpoint_free_objfile (struct objfile *objfile)
|
|||
struct bp_location **locp, *loc;
|
||||
|
||||
ALL_BP_LOCATIONS (loc, locp)
|
||||
if (loc->symtab != NULL && loc->symtab->objfile == objfile)
|
||||
if (loc->symtab != NULL && SYMTAB_OBJFILE (loc->symtab) == objfile)
|
||||
loc->symtab = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ edit_command (char *arg, int from_tty)
|
|||
error (_("No source file for address %s."),
|
||||
paddress (get_current_arch (), sal.pc));
|
||||
|
||||
gdbarch = get_objfile_arch (sal.symtab->objfile);
|
||||
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
|
||||
sym = find_pc_function (sal.pc);
|
||||
if (sym)
|
||||
printf_filtered ("%s is in %s (%s:%d).\n",
|
||||
|
@ -1003,7 +1003,7 @@ list_command (char *arg, int from_tty)
|
|||
error (_("No source file for address %s."),
|
||||
paddress (get_current_arch (), sal.pc));
|
||||
|
||||
gdbarch = get_objfile_arch (sal.symtab->objfile);
|
||||
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
|
||||
sym = find_pc_function (sal.pc);
|
||||
if (sym)
|
||||
printf_filtered ("%s is in %s (%s:%d).\n",
|
||||
|
|
|
@ -686,19 +686,19 @@ gdbscm_lookup_block (SCM pc_scm)
|
|||
section = find_pc_mapped_section (pc);
|
||||
symtab = find_pc_sect_symtab (pc, section);
|
||||
|
||||
if (symtab != NULL && symtab->objfile != NULL)
|
||||
if (symtab != NULL && SYMTAB_OBJFILE (symtab) != NULL)
|
||||
block = block_for_pc (pc);
|
||||
}
|
||||
GDBSCM_HANDLE_GDB_EXCEPTION (except);
|
||||
|
||||
if (symtab == NULL || symtab->objfile == NULL)
|
||||
if (symtab == NULL || SYMTAB_OBJFILE (symtab) == NULL)
|
||||
{
|
||||
gdbscm_out_of_range_error (FUNC_NAME, SCM_ARG1, pc_scm,
|
||||
_("cannot locate object file for block"));
|
||||
}
|
||||
|
||||
if (block != NULL)
|
||||
return bkscm_scm_from_block (block, symtab->objfile);
|
||||
return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
|
||||
return SCM_BOOL_F;
|
||||
}
|
||||
|
||||
|
|
|
@ -612,7 +612,7 @@ gdbscm_frame_block (SCM self)
|
|||
SCM block_scm;
|
||||
|
||||
st = SYMBOL_SYMTAB (BLOCK_FUNCTION (fn_block));
|
||||
return bkscm_scm_from_block (block, st->objfile);
|
||||
return bkscm_scm_from_block (block, SYMTAB_OBJFILE (st));
|
||||
}
|
||||
|
||||
return SCM_BOOL_F;
|
||||
|
|
|
@ -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;
|
||||
struct objfile *objfile = SYMTAB_OBJFILE (symtab);
|
||||
htab_t htab = 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);
|
||||
return ofscm_scm_from_objfile (SYMTAB_OBJFILE (symtab));
|
||||
}
|
||||
|
||||
/* (symtab-global-block <gdb:symtab>) -> <gdb:block>
|
||||
|
@ -366,7 +366,7 @@ gdbscm_symtab_global_block (SCM self)
|
|||
blockvector = BLOCKVECTOR (symtab);
|
||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
||||
|
||||
return bkscm_scm_from_block (block, symtab->objfile);
|
||||
return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
|
||||
}
|
||||
|
||||
/* (symtab-static-block <gdb:symtab>) -> <gdb:block>
|
||||
|
@ -384,7 +384,7 @@ gdbscm_symtab_static_block (SCM self)
|
|||
blockvector = BLOCKVECTOR (symtab);
|
||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
||||
|
||||
return bkscm_scm_from_block (block, symtab->objfile);
|
||||
return bkscm_scm_from_block (block, SYMTAB_OBJFILE (symtab));
|
||||
}
|
||||
|
||||
/* Administrivia for sal (symtab-and-line) smobs. */
|
||||
|
|
|
@ -49,7 +49,7 @@ mi_cmd_symbol_list_lines (char *command, char **argv, int argc)
|
|||
already sorted by increasing values in the symbol table, so no
|
||||
need to perform any other sorting. */
|
||||
|
||||
gdbarch = get_objfile_arch (s->objfile);
|
||||
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
|
||||
cleanup_stack = make_cleanup_ui_out_list_begin_end (uiout, "lines");
|
||||
|
||||
if (LINETABLE (s) != NULL && LINETABLE (s)->nitems > 0)
|
||||
|
|
|
@ -641,7 +641,7 @@ free_objfile (struct objfile *objfile)
|
|||
{
|
||||
struct symtab_and_line cursal = get_current_source_symtab_and_line ();
|
||||
|
||||
if (cursal.symtab && cursal.symtab->objfile == objfile)
|
||||
if (cursal.symtab && SYMTAB_OBJFILE (cursal.symtab) == objfile)
|
||||
clear_current_source_symtab_and_line ();
|
||||
}
|
||||
|
||||
|
|
|
@ -384,12 +384,12 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
|
|||
section = find_pc_mapped_section (pc);
|
||||
symtab = find_pc_sect_symtab (pc, section);
|
||||
|
||||
if (symtab != NULL && symtab->objfile != NULL)
|
||||
if (symtab != NULL && SYMTAB_OBJFILE (symtab) != NULL)
|
||||
block = block_for_pc (pc);
|
||||
}
|
||||
GDB_PY_HANDLE_EXCEPTION (except);
|
||||
|
||||
if (!symtab || symtab->objfile == NULL)
|
||||
if (!symtab || SYMTAB_OBJFILE (symtab) == NULL)
|
||||
{
|
||||
PyErr_SetString (PyExc_RuntimeError,
|
||||
_("Cannot locate object file for block."));
|
||||
|
@ -397,7 +397,7 @@ gdbpy_block_for_pc (PyObject *self, PyObject *args)
|
|||
}
|
||||
|
||||
if (block)
|
||||
return block_to_block_object (block, symtab->objfile);
|
||||
return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
|
||||
|
||||
Py_RETURN_NONE;
|
||||
}
|
||||
|
|
|
@ -303,7 +303,7 @@ frapy_block (PyObject *self, PyObject *args)
|
|||
struct symtab *symt;
|
||||
|
||||
symt = SYMBOL_SYMTAB (BLOCK_FUNCTION (fn_block));
|
||||
return block_to_block_object (block, symt->objfile);
|
||||
return block_to_block_object (block, SYMTAB_OBJFILE (symt));
|
||||
}
|
||||
|
||||
Py_RETURN_NONE;
|
||||
|
|
|
@ -121,7 +121,7 @@ stpy_get_objfile (PyObject *self, void *closure)
|
|||
|
||||
STPY_REQUIRE_VALID (self, symtab);
|
||||
|
||||
result = objfile_to_objfile_object (symtab->objfile);
|
||||
result = objfile_to_objfile_object (SYMTAB_OBJFILE (symtab));
|
||||
Py_XINCREF (result);
|
||||
return result;
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ stpy_global_block (PyObject *self, PyObject *args)
|
|||
|
||||
blockvector = BLOCKVECTOR (symtab);
|
||||
block = BLOCKVECTOR_BLOCK (blockvector, GLOBAL_BLOCK);
|
||||
return block_to_block_object (block, symtab->objfile);
|
||||
return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
|
||||
}
|
||||
|
||||
/* Return the STATIC_BLOCK of the underlying symtab. */
|
||||
|
@ -202,7 +202,7 @@ stpy_static_block (PyObject *self, PyObject *args)
|
|||
|
||||
blockvector = BLOCKVECTOR (symtab);
|
||||
block = BLOCKVECTOR_BLOCK (blockvector, STATIC_BLOCK);
|
||||
return block_to_block_object (block, symtab->objfile);
|
||||
return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
|
||||
}
|
||||
|
||||
/* Implementation of gdb.Symtab.linetable (self) -> gdb.Linetable.
|
||||
|
@ -252,7 +252,7 @@ stpy_dealloc (PyObject *obj)
|
|||
symtab->prev->next = symtab->next;
|
||||
else if (symtab->symtab)
|
||||
{
|
||||
set_objfile_data (symtab->symtab->objfile,
|
||||
set_objfile_data (SYMTAB_OBJFILE (symtab->symtab),
|
||||
stpy_objfile_data_key, symtab->next);
|
||||
}
|
||||
if (symtab->next)
|
||||
|
@ -333,7 +333,7 @@ salpy_dealloc (PyObject *self)
|
|||
if (self_sal->prev)
|
||||
self_sal->prev->next = self_sal->next;
|
||||
else if (self_sal->symtab != (symtab_object * ) Py_None)
|
||||
set_objfile_data (self_sal->symtab->symtab->objfile,
|
||||
set_objfile_data (SYMTAB_OBJFILE (self_sal->symtab->symtab),
|
||||
salpy_objfile_data_key, self_sal->next);
|
||||
|
||||
if (self_sal->next)
|
||||
|
@ -377,12 +377,12 @@ set_sal (sal_object *sal_obj, struct symtab_and_line sal)
|
|||
objfile cleanup observer linked list. */
|
||||
if (sal_obj->symtab != (symtab_object *)Py_None)
|
||||
{
|
||||
sal_obj->next = objfile_data (sal_obj->symtab->symtab->objfile,
|
||||
sal_obj->next = objfile_data (SYMTAB_OBJFILE (sal_obj->symtab->symtab),
|
||||
salpy_objfile_data_key);
|
||||
if (sal_obj->next)
|
||||
sal_obj->next->prev = sal_obj;
|
||||
|
||||
set_objfile_data (sal_obj->symtab->symtab->objfile,
|
||||
set_objfile_data (SYMTAB_OBJFILE (sal_obj->symtab->symtab),
|
||||
salpy_objfile_data_key, sal_obj);
|
||||
}
|
||||
else
|
||||
|
@ -403,10 +403,11 @@ set_symtab (symtab_object *obj, struct symtab *symtab)
|
|||
obj->prev = NULL;
|
||||
if (symtab)
|
||||
{
|
||||
obj->next = objfile_data (symtab->objfile, stpy_objfile_data_key);
|
||||
obj->next = objfile_data (SYMTAB_OBJFILE (symtab),
|
||||
stpy_objfile_data_key);
|
||||
if (obj->next)
|
||||
obj->next->prev = obj;
|
||||
set_objfile_data (symtab->objfile, stpy_objfile_data_key, obj);
|
||||
set_objfile_data (SYMTAB_OBJFILE (symtab), stpy_objfile_data_key, obj);
|
||||
}
|
||||
else
|
||||
obj->next = NULL;
|
||||
|
|
|
@ -1189,8 +1189,8 @@ find_source_lines (struct symtab *s, int desc)
|
|||
if (fstat (desc, &st) < 0)
|
||||
perror_with_name (symtab_to_filename_for_display (s));
|
||||
|
||||
if (s->objfile && s->objfile->obfd)
|
||||
mtime = s->objfile->mtime;
|
||||
if (SYMTAB_OBJFILE (s) != NULL && SYMTAB_OBJFILE (s)->obfd != NULL)
|
||||
mtime = SYMTAB_OBJFILE (s)->mtime;
|
||||
else if (exec_bfd)
|
||||
mtime = exec_bfd_mtime;
|
||||
|
||||
|
@ -1294,7 +1294,7 @@ identify_source_line (struct symtab *s, int line, int mid_statement,
|
|||
/* Don't index off the end of the line_charpos array. */
|
||||
return 0;
|
||||
annotate_source (s->fullname, line, s->line_charpos[line - 1],
|
||||
mid_statement, get_objfile_arch (s->objfile), pc);
|
||||
mid_statement, get_objfile_arch (SYMTAB_OBJFILE (s)), pc);
|
||||
|
||||
current_source_line = line;
|
||||
current_source_symtab = s;
|
||||
|
@ -1538,7 +1538,8 @@ line_info (char *arg, int from_tty)
|
|||
else if (sal.line > 0
|
||||
&& find_line_pc_range (sal, &start_pc, &end_pc))
|
||||
{
|
||||
struct gdbarch *gdbarch = get_objfile_arch (sal.symtab->objfile);
|
||||
struct gdbarch *gdbarch
|
||||
= get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
|
||||
|
||||
if (start_pc == end_pc)
|
||||
{
|
||||
|
|
|
@ -2947,7 +2947,7 @@ allocate_symtab (const char *filename, struct objfile *objfile)
|
|||
|
||||
/* Hook it to the objfile it comes from. */
|
||||
|
||||
symtab->objfile = objfile;
|
||||
SYMTAB_OBJFILE (symtab) = objfile;
|
||||
symtab->next = objfile->symtabs;
|
||||
objfile->symtabs = symtab;
|
||||
|
||||
|
|
|
@ -182,7 +182,7 @@ dump_objfile (struct objfile *objfile)
|
|||
printf_filtered ("%s at ", symtab_to_filename_for_display (symtab));
|
||||
gdb_print_host_address (symtab, gdb_stdout);
|
||||
printf_filtered (", ");
|
||||
if (symtab->objfile != objfile)
|
||||
if (SYMTAB_OBJFILE (symtab) != objfile)
|
||||
{
|
||||
printf_filtered ("NOT ON CHAIN! ");
|
||||
}
|
||||
|
|
|
@ -2317,7 +2317,7 @@ find_pc_sect_line (CORE_ADDR pc, struct obj_section *section, int notcurrent)
|
|||
}
|
||||
|
||||
bv = BLOCKVECTOR (s);
|
||||
objfile = s->objfile;
|
||||
objfile = SYMTAB_OBJFILE (s);
|
||||
|
||||
/* Look at all the symtabs that share this blockvector.
|
||||
They all have the same apriori range, that we found was right;
|
||||
|
|
|
@ -774,7 +774,7 @@ extern const struct symbol_impl *symbol_impls;
|
|||
#define SYMBOL_BLOCK_OPS(symbol) (SYMBOL_IMPL (symbol).ops_block)
|
||||
#define SYMBOL_REGISTER_OPS(symbol) (SYMBOL_IMPL (symbol).ops_register)
|
||||
#define SYMBOL_LOCATION_BATON(symbol) (symbol)->aux_value
|
||||
#define SYMBOL_OBJFILE(symbol) (SYMBOL_SYMTAB (symbol)->objfile)
|
||||
#define SYMBOL_OBJFILE(symbol) SYMTAB_OBJFILE (SYMBOL_SYMTAB (symbol))
|
||||
|
||||
extern int register_symbol_computed_impl (enum address_class,
|
||||
const struct symbol_computed_ops *);
|
||||
|
@ -982,7 +982,8 @@ struct symtab
|
|||
|
||||
#define BLOCKVECTOR(symtab) (symtab)->blockvector
|
||||
#define LINETABLE(symtab) (symtab)->linetable
|
||||
#define SYMTAB_PSPACE(symtab) (symtab)->objfile->pspace
|
||||
#define SYMTAB_OBJFILE(symtab) ((symtab)->objfile)
|
||||
#define SYMTAB_PSPACE(symtab) (SYMTAB_OBJFILE (symtab)->pspace)
|
||||
|
||||
/* Call this to set the "primary" field in struct symtab. */
|
||||
extern void set_symtab_primary (struct symtab *, int primary);
|
||||
|
|
|
@ -111,7 +111,7 @@ tui_set_source_content (struct symtab *s,
|
|||
stream = fdopen (desc, FOPEN_RT);
|
||||
clearerr (stream);
|
||||
cur_line = 0;
|
||||
src->gdbarch = get_objfile_arch (s->objfile);
|
||||
src->gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
|
||||
src->start_line_or_addr.loa = LOA_LINE;
|
||||
cur_line_no = src->start_line_or_addr.u.line_no = line_no;
|
||||
if (offset > 0)
|
||||
|
|
|
@ -115,7 +115,7 @@ tui_update_source_window_as_is (struct tui_win_info *win_info,
|
|||
sal.line = line_or_addr.u.line_no +
|
||||
(win_info->generic.content_size - 2);
|
||||
sal.symtab = s;
|
||||
sal.pspace = s->objfile->pspace;
|
||||
sal.pspace = SYMTAB_PSPACE (s);
|
||||
set_current_source_symtab_and_line (&sal);
|
||||
/* If the focus was in the asm win, put it in the src win if
|
||||
we don't have a split layout. */
|
||||
|
@ -183,7 +183,7 @@ tui_update_source_windows_with_line (struct symtab *s, int line)
|
|||
if (!s)
|
||||
return;
|
||||
|
||||
gdbarch = get_objfile_arch (s->objfile);
|
||||
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
|
||||
|
||||
switch (tui_current_layout ())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue