+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.
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;
}
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;
}
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
{
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;
}
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",
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",
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;
}
\f
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;
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)
= 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>
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>
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));
}
\f
/* Administrivia for sal (symtab-and-line) smobs. */
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)
{
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 ();
}
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."));
}
if (block)
- return block_to_block_object (block, symtab->objfile);
+ return block_to_block_object (block, SYMTAB_OBJFILE (symtab));
Py_RETURN_NONE;
}
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;
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;
}
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. */
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.
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)
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)
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
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;
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;
/* 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;
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)
{
/* Hook it to the objfile it comes from. */
- symtab->objfile = objfile;
+ SYMTAB_OBJFILE (symtab) = objfile;
symtab->next = objfile->symtabs;
objfile->symtabs = symtab;
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! ");
}
}
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;
#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 *);
#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);
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)
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. */
if (!s)
return;
- gdbarch = get_objfile_arch (s->objfile);
+ gdbarch = get_objfile_arch (SYMTAB_OBJFILE (s));
switch (tui_current_layout ())
{