aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Evans <xdje42@gmail.com>2014-12-23 07:21:10 -0800
committerDoug Evans <xdje42@gmail.com>2014-12-23 07:21:10 -0800
commit08be3fe322244a3684d007d9282e225fc215f5d8 (patch)
tree083e30284643e51dbc49b6b3ab9a3e3a5a0e6e35
parent4347085ad3e84bdc1f91e7121cedf3e79a9467fb (diff)
downloadgdb-08be3fe322244a3684d007d9282e225fc215f5d8.zip
gdb-08be3fe322244a3684d007d9282e225fc215f5d8.tar.gz
gdb-08be3fe322244a3684d007d9282e225fc215f5d8.tar.bz2
Replace some symbol accessor macros with functions.
gdb/ChangeLog: * symtab.h (SYMBOL_SYMTAB): Delete (SYMBOL_OBJFILE): Delete. (symbol_symtab, symbol_set_symtab): Declare. (symbol_objfile, symbol_arch): Declare. * symtab.c (symbol_symtab): Replaces SYMBOL_SYMTAB. All uses updated. All references to symbol->symtab redirected through here. (symbol_set_symtab): New function. All assignments to SYMBOL_SYMTAB redirected through here. (symbol_arch): New function. (symbol_objfile): New function. Replaces SYMBOL_OBJFILE. All uses updated. * cp-namespace.c (cp_lookup_symbol_imports_or_template): Call symbol_arch. * findvar.c (default_read_var_value): Call symbol_arch. * guile/scm-frame.c (gdbscm_frame_block): Call symbol_objfile. * jv-lang.c (add_class_symtab_symbol): Call symbol_arch. * printcmd.c (address_info): Call symbol_arch. * tracepoint.c (scope_info): Call symbol_arch.
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/ada-lang.c6
-rw-r--r--gdb/btrace.c8
-rw-r--r--gdb/buildsym.c12
-rw-r--r--gdb/compile/compile-c-symbols.c2
-rw-r--r--gdb/cp-namespace.c3
-rw-r--r--gdb/dwarf2read.c7
-rw-r--r--gdb/findvar.c12
-rw-r--r--gdb/frame.c2
-rw-r--r--gdb/guile/scm-frame.c7
-rw-r--r--gdb/guile/scm-symbol.c4
-rw-r--r--gdb/infcmd.c2
-rw-r--r--gdb/jit.c2
-rw-r--r--gdb/jv-lang.c3
-rw-r--r--gdb/linespec.c24
-rw-r--r--gdb/mdebugread.c2
-rw-r--r--gdb/parse.c2
-rw-r--r--gdb/printcmd.c4
-rw-r--r--gdb/python/py-frame.c6
-rw-r--r--gdb/python/py-symbol.c16
-rw-r--r--gdb/record-btrace.c2
-rw-r--r--gdb/symmisc.c2
-rw-r--r--gdb/symtab.c66
-rw-r--r--gdb/symtab.h24
-rw-r--r--gdb/tracepoint.c2
-rw-r--r--gdb/valops.c2
26 files changed, 156 insertions, 87 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 1530aeb..a609cb2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,24 @@
+2014-12-23 Doug Evans <xdje42@gmail.com>
+
+ * symtab.h (SYMBOL_SYMTAB): Delete
+ (SYMBOL_OBJFILE): Delete.
+ (symbol_symtab, symbol_set_symtab): Declare.
+ (symbol_objfile, symbol_arch): Declare.
+ * symtab.c (symbol_symtab): Replaces SYMBOL_SYMTAB. All uses updated.
+ All references to symbol->symtab redirected through here.
+ (symbol_set_symtab): New function. All assignments to SYMBOL_SYMTAB
+ redirected through here.
+ (symbol_arch): New function.
+ (symbol_objfile): New function. Replaces SYMBOL_OBJFILE.
+ All uses updated.
+ * cp-namespace.c (cp_lookup_symbol_imports_or_template): Call
+ symbol_arch.
+ * findvar.c (default_read_var_value): Call symbol_arch.
+ * guile/scm-frame.c (gdbscm_frame_block): Call symbol_objfile.
+ * jv-lang.c (add_class_symtab_symbol): Call symbol_arch.
+ * printcmd.c (address_info): Call symbol_arch.
+ * tracepoint.c (scope_info): Call symbol_arch.
+
2014-12-22 Doug Evans <xdje42@gmail.com>
* cp-namespace.c (cp_lookup_symbol_via_all_imports): New function.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index a45e770..f453ef0 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3716,7 +3716,7 @@ See set/show multiple-symbol."));
(SYMBOL_CLASS (syms[i].sym) == LOC_CONST
&& SYMBOL_TYPE (syms[i].sym) != NULL
&& TYPE_CODE (SYMBOL_TYPE (syms[i].sym)) == TYPE_CODE_ENUM);
- struct symtab *symtab = SYMBOL_SYMTAB (syms[i].sym);
+ struct symtab *symtab = symbol_symtab (syms[i].sym);
if (SYMBOL_LINE (syms[i].sym) != 0 && symtab != NULL)
printf_unfiltered (_("[%d] %s at %s:%d\n"),
@@ -4471,9 +4471,9 @@ cache_symbol (const char *name, domain_enum namespace, struct symbol *sym,
the symbol is local or not, we check the block where we found it
against the global and static blocks of its associated symtab. */
if (sym
- && BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (sym->symtab),
+ && BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symbol_symtab (sym)),
GLOBAL_BLOCK) != block
- && BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (sym->symtab),
+ && BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (symbol_symtab (sym)),
STATIC_BLOCK) != block)
return;
diff --git a/gdb/btrace.c b/gdb/btrace.c
index b8b5139..b8e2fab 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -79,7 +79,7 @@ ftrace_print_filename (const struct btrace_function *bfun)
sym = bfun->sym;
if (sym != NULL)
- filename = symtab_to_filename_for_display (sym->symtab);
+ filename = symtab_to_filename_for_display (symbol_symtab (sym));
else
filename = "<unknown>";
@@ -151,8 +151,8 @@ ftrace_function_switched (const struct btrace_function *bfun,
return 1;
/* Check the location of those functions, as well. */
- bfname = symtab_to_fullname (sym->symtab);
- fname = symtab_to_fullname (fun->symtab);
+ bfname = symtab_to_fullname (symbol_symtab (sym));
+ fname = symtab_to_fullname (symbol_symtab (fun));
if (filename_cmp (fname, bfname) != 0)
return 1;
}
@@ -183,7 +183,7 @@ ftrace_skip_file (const struct btrace_function *bfun, const char *fullname)
if (sym == NULL)
return 1;
- bfile = symtab_to_fullname (sym->symtab);
+ bfile = symtab_to_fullname (symbol_symtab (sym));
return (filename_cmp (bfile, fullname) != 0);
}
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 35b3f17..0797c95 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1451,15 +1451,15 @@ end_symtab_with_blockvector (struct block *static_block,
/* Inlined functions may have symbols not in the global or
static symbol lists. */
if (BLOCK_FUNCTION (block) != NULL)
- if (SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) == NULL)
- SYMBOL_SYMTAB (BLOCK_FUNCTION (block)) = symtab;
+ if (symbol_symtab (BLOCK_FUNCTION (block)) == NULL)
+ symbol_set_symtab (BLOCK_FUNCTION (block), symtab);
/* Note that we only want to fix up symbols from the local
blocks, not blocks coming from included symtabs. That is why
we use ALL_DICT_SYMBOLS here and not ALL_BLOCK_SYMBOLS. */
ALL_DICT_SYMBOLS (BLOCK_DICT (block), iter, sym)
- if (SYMBOL_SYMTAB (sym) == NULL)
- SYMBOL_SYMTAB (sym) = symtab;
+ if (symbol_symtab (sym) == NULL)
+ symbol_set_symtab (sym, symtab);
}
}
@@ -1560,8 +1560,8 @@ set_missing_symtab (struct pending *pending_list,
{
for (i = 0; i < pending->nsyms; ++i)
{
- if (SYMBOL_SYMTAB (pending->symbol[i]) == NULL)
- SYMBOL_SYMTAB (pending->symbol[i]) = COMPUNIT_FILETABS (cu);
+ if (symbol_symtab (pending->symbol[i]) == NULL)
+ symbol_set_symtab (pending->symbol[i], COMPUNIT_FILETABS (cu));
}
}
}
diff --git a/gdb/compile/compile-c-symbols.c b/gdb/compile/compile-c-symbols.c
index b489c74..c529cf8 100644
--- a/gdb/compile/compile-c-symbols.c
+++ b/gdb/compile/compile-c-symbols.c
@@ -149,7 +149,7 @@ convert_one_symbol (struct compile_c_instance *context,
int is_local)
{
gcc_type sym_type;
- const char *filename = SYMBOL_SYMTAB (sym)->filename;
+ const char *filename = symbol_symtab (sym)->filename;
unsigned short line = SYMBOL_LINE (sym);
error_symbol_once (context, sym);
diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 6e256e1..0cbf902 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -624,8 +624,7 @@ cp_lookup_symbol_imports_or_template (const char *scope,
char *name_copy = xstrdup (SYMBOL_NATURAL_NAME (function));
struct cleanup *cleanups = make_cleanup (xfree, name_copy);
const struct language_defn *lang = language_def (language_cplus);
- struct gdbarch *arch
- = get_objfile_arch (SYMBOL_OBJFILE (function));
+ struct gdbarch *arch = symbol_arch (function);
const struct block *parent = BLOCK_SUPERBLOCK (block);
while (1)
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 0e8f937..378c3b1 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -7746,8 +7746,9 @@ fixup_go_packaging (struct dwarf2_cu *cu)
if (strcmp (package_name, this_package_name) != 0)
complaint (&symfile_complaints,
_("Symtab %s has objects from two different Go packages: %s and %s"),
- (SYMBOL_SYMTAB (sym)
- ? symtab_to_filename_for_display (SYMBOL_SYMTAB (sym))
+ (symbol_symtab (sym) != NULL
+ ? symtab_to_filename_for_display
+ (symbol_symtab (sym))
: objfile_name (cu->objfile)),
this_package_name, package_name);
xfree (this_package_name);
@@ -17935,7 +17936,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
struct file_entry *fe;
fe = &cu->line_header->file_names[file_index - 1];
- SYMBOL_SYMTAB (sym) = fe->symtab;
+ symbol_set_symtab (sym, fe->symtab);
}
}
diff --git a/gdb/findvar.c b/gdb/findvar.c
index 512c572..d2adec4 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -455,7 +455,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
{
CORE_ADDR addr
= symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
- SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
+ SYMBOL_OBJ_SECTION (symbol_objfile (var),
var));
store_typed_address (value_contents_raw (v), type, addr);
@@ -481,7 +481,7 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_STATIC:
if (overlay_debugging)
addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (var),
- SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
+ SYMBOL_OBJ_SECTION (symbol_objfile (var),
var));
else
addr = SYMBOL_VALUE_ADDRESS (var);
@@ -523,8 +523,8 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
case LOC_BLOCK:
if (overlay_debugging)
addr = symbol_overlayed_address
- (BLOCK_START (SYMBOL_BLOCK_VALUE (var)), SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (var),
- var));
+ (BLOCK_START (SYMBOL_BLOCK_VALUE (var)),
+ SYMBOL_OBJ_SECTION (symbol_objfile (var), var));
else
addr = BLOCK_START (SYMBOL_BLOCK_VALUE (var));
break;
@@ -573,9 +573,9 @@ default_read_var_value (struct symbol *var, struct frame_info *frame)
lookup_data.name = SYMBOL_LINKAGE_NAME (var);
gdbarch_iterate_over_objfiles_in_search_order
- (get_objfile_arch (SYMBOL_OBJFILE (var)),
+ (symbol_arch (var),
minsym_lookup_iterator_cb, &lookup_data,
- SYMBOL_OBJFILE (var));
+ symbol_objfile (var));
msym = lookup_data.result.minsym;
if (msym == NULL)
diff --git a/gdb/frame.c b/gdb/frame.c
index 75ad341..54aff59 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -2346,7 +2346,7 @@ find_frame_sal (struct frame_info *frame, struct symtab_and_line *sal)
init_sal (sal);
if (SYMBOL_LINE (sym) != 0)
{
- sal->symtab = SYMBOL_SYMTAB (sym);
+ sal->symtab = symbol_symtab (sym);
sal->line = SYMBOL_LINE (sym);
}
else
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index b2d662e..70572ab 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -608,11 +608,8 @@ gdbscm_frame_block (SCM self)
if (block != NULL)
{
- struct symtab *st;
- SCM block_scm;
-
- st = SYMBOL_SYMTAB (BLOCK_FUNCTION (fn_block));
- return bkscm_scm_from_block (block, SYMTAB_OBJFILE (st));
+ return bkscm_scm_from_block
+ (block, symbol_objfile (BLOCK_FUNCTION (fn_block)));
}
return SCM_BOOL_F;
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index d80aa54..6a19648 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -81,7 +81,7 @@ syscm_eq_symbol_smob (const void *ap, const void *bp)
static htab_t
syscm_objfile_symbol_map (struct symbol *symbol)
{
- struct objfile *objfile = SYMBOL_OBJFILE (symbol);
+ struct objfile *objfile = symbol_objfile (symbol);
htab_t htab = objfile_data (objfile, syscm_objfile_data_key);
if (htab == NULL)
@@ -329,7 +329,7 @@ gdbscm_symbol_symtab (SCM self)
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
const struct symbol *symbol = s_smob->symbol;
- return stscm_scm_from_symtab (SYMBOL_SYMTAB (symbol));
+ return stscm_scm_from_symtab (symbol_symtab (symbol));
}
/* (symbol-name <gdb:symbol>) -> string */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9b65f1a..ec39cec 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -1202,7 +1202,7 @@ jump_command (char *arg, int from_tty)
struct obj_section *section;
fixup_symbol_section (sfn, 0);
- section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sfn), sfn);
+ section = SYMBOL_OBJ_SECTION (symbol_objfile (sfn), sfn);
if (section_is_overlay (section)
&& !section_is_mapped (section))
{
diff --git a/gdb/jit.c b/gdb/jit.c
index 1e42ce2..8d3290a 100644
--- a/gdb/jit.c
+++ b/gdb/jit.c
@@ -697,7 +697,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
/* The name. */
SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
SYMBOL_ACLASS_INDEX (block_name) = LOC_BLOCK;
- SYMBOL_SYMTAB (block_name) = COMPUNIT_FILETABS (cust);
+ symbol_set_symtab (block_name, COMPUNIT_FILETABS (cust));
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c
index c73def8..e0f0fb3 100644
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -174,8 +174,7 @@ get_java_class_symtab (struct gdbarch *gdbarch)
static void
add_class_symtab_symbol (struct symbol *sym)
{
- struct compunit_symtab *cust
- = get_java_class_symtab (get_objfile_arch (SYMBOL_OBJFILE (sym)));
+ struct compunit_symtab *cust = get_java_class_symtab (symbol_arch (sym));
const struct blockvector *bv = COMPUNIT_BLOCKVECTOR (cust);
dict_add_symbol (BLOCK_DICT (BLOCKVECTOR_BLOCK (bv, GLOBAL_BLOCK)), sym);
diff --git a/gdb/linespec.c b/gdb/linespec.c
index ef4173c..fe71d71 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2011,7 +2011,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
for (i = 0; VEC_iterate (symbolp, ls->labels.label_symbols, i, sym); ++i)
{
- struct program_space *pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ struct program_space *pspace = SYMTAB_PSPACE (symbol_symtab (sym));
if (symbol_to_sal (&sal, state->funfirstline, sym)
&& maybe_add_address (state->addr_set, pspace, sal.pc))
@@ -2038,7 +2038,7 @@ convert_linespec_to_sals (struct linespec_state *state, linespec_p ls)
for (i = 0; VEC_iterate (symbolp, ls->function_symbols, i, sym); ++i)
{
- pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ pspace = SYMTAB_PSPACE (symbol_symtab (sym));
set_current_program_space (pspace);
if (symbol_to_sal (&sal, state->funfirstline, sym)
&& maybe_add_address (state->addr_set, pspace, sal.pc))
@@ -2776,8 +2776,8 @@ compare_symbols (const void *a, const void *b)
struct symbol * const *sb = b;
uintptr_t uia, uib;
- uia = (uintptr_t) SYMTAB_PSPACE (SYMBOL_SYMTAB (*sa));
- uib = (uintptr_t) SYMTAB_PSPACE (SYMBOL_SYMTAB (*sb));
+ uia = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (*sa));
+ uib = (uintptr_t) SYMTAB_PSPACE (symbol_symtab (*sb));
if (uia < uib)
return -1;
@@ -2921,8 +2921,8 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs,
/* Program spaces that are executing startup should have
been filtered out earlier. */
- gdb_assert (!SYMTAB_PSPACE (SYMBOL_SYMTAB (sym))->executing_startup);
- pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ pspace = SYMTAB_PSPACE (symbol_symtab (sym));
+ gdb_assert (!pspace->executing_startup);
set_current_program_space (pspace);
t = check_typedef (SYMBOL_TYPE (sym));
find_methods (t, method_name, &result_names, &superclass_vec);
@@ -2931,7 +2931,7 @@ find_method (struct linespec_state *self, VEC (symtab_ptr) *file_symtabs,
sure not to miss the last batch. */
if (ix == VEC_length (symbolp, sym_classes) - 1
|| (pspace
- != SYMTAB_PSPACE (SYMBOL_SYMTAB (VEC_index (symbolp, sym_classes,
+ != SYMTAB_PSPACE (symbol_symtab (VEC_index (symbolp, sym_classes,
ix + 1)))))
{
/* If we did not find a direct implementation anywhere in
@@ -3247,7 +3247,7 @@ find_label_symbols (struct linespec_state *self,
for (ix = 0;
VEC_iterate (symbolp, function_symbols, ix, fn_sym); ++ix)
{
- set_current_program_space (SYMTAB_PSPACE (SYMBOL_SYMTAB (fn_sym)));
+ set_current_program_space (SYMTAB_PSPACE (symbol_symtab (fn_sym)));
block = SYMBOL_BLOCK_VALUE (fn_sym);
sym = lookup_symbol (name, block, LABEL_DOMAIN, 0);
@@ -3703,10 +3703,10 @@ symbol_to_sal (struct symtab_and_line *result,
if (SYMBOL_CLASS (sym) == LOC_LABEL && SYMBOL_VALUE_ADDRESS (sym) != 0)
{
init_sal (result);
- result->symtab = SYMBOL_SYMTAB (sym);
+ result->symtab = symbol_symtab (sym);
result->line = SYMBOL_LINE (sym);
result->pc = SYMBOL_VALUE_ADDRESS (sym);
- result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ result->pspace = SYMTAB_PSPACE (result->symtab);
result->explicit_pc = 1;
return 1;
}
@@ -3718,9 +3718,9 @@ symbol_to_sal (struct symtab_and_line *result,
{
/* We know its line number. */
init_sal (result);
- result->symtab = SYMBOL_SYMTAB (sym);
+ result->symtab = symbol_symtab (sym);
result->line = SYMBOL_LINE (sym);
- result->pspace = SYMTAB_PSPACE (SYMBOL_SYMTAB (sym));
+ result->pspace = SYMTAB_PSPACE (result->symtab);
return 1;
}
}
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index bcbd9b0..ed5d1d1 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -4596,7 +4596,7 @@ mylookup_symbol (char *name, const struct block *block,
static void
add_symbol (struct symbol *s, struct symtab *symtab, struct block *b)
{
- SYMBOL_SYMTAB (s) = symtab;
+ symbol_set_symtab (s, symtab);
dict_add_symbol (BLOCK_DICT (b), s);
}
diff --git a/gdb/parse.c b/gdb/parse.c
index d161776..877b082 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -1810,7 +1810,7 @@ operator_check_standard (struct expression *exp, int pos,
/* Check objfile where the variable itself is placed.
SYMBOL_OBJ_SECTION (symbol) may be NULL. */
- if ((*objfile_func) (SYMBOL_OBJFILE (symbol), data))
+ if ((*objfile_func) (symbol_objfile (symbol), data))
return 1;
/* Check objfile where is placed the code touching the variable. */
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index d13b610..58b7ac0 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1251,8 +1251,8 @@ address_info (char *exp, int from_tty)
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is ");
val = SYMBOL_VALUE (sym);
- section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
- gdbarch = get_objfile_arch (SYMBOL_OBJFILE (sym));
+ section = SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym);
+ gdbarch = symbol_arch (sym);
if (SYMBOL_COMPUTED_OPS (sym) != NULL)
{
diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c
index 62176df..d78d807 100644
--- a/gdb/python/py-frame.c
+++ b/gdb/python/py-frame.c
@@ -300,10 +300,8 @@ frapy_block (PyObject *self, PyObject *args)
if (block)
{
- struct symtab *symt;
-
- symt = SYMBOL_SYMTAB (BLOCK_FUNCTION (fn_block));
- return block_to_block_object (block, SYMTAB_OBJFILE (symt));
+ return block_to_block_object
+ (block, symbol_objfile (BLOCK_FUNCTION (fn_block)));
}
Py_RETURN_NONE;
diff --git a/gdb/python/py-symbol.c b/gdb/python/py-symbol.c
index caf0a74..62fde64 100644
--- a/gdb/python/py-symbol.c
+++ b/gdb/python/py-symbol.c
@@ -87,7 +87,7 @@ sympy_get_symtab (PyObject *self, void *closure)
SYMPY_REQUIRE_VALID (self, symbol);
- return symtab_to_symtab_object (SYMBOL_SYMTAB (symbol));
+ return symtab_to_symtab_object (symbol_symtab (symbol));
}
static PyObject *
@@ -290,15 +290,14 @@ set_symbol (symbol_object *obj, struct symbol *symbol)
{
obj->symbol = symbol;
obj->prev = NULL;
- if (SYMBOL_SYMTAB (symbol))
+ if (symbol_symtab (symbol) != NULL)
{
- obj->next = objfile_data (SYMBOL_OBJFILE (symbol),
- sympy_objfile_data_key);
+ struct objfile *objfile = symbol_objfile (symbol);
+ obj->next = objfile_data (objfile, sympy_objfile_data_key);
if (obj->next)
obj->next->prev = obj;
- set_objfile_data (SYMBOL_OBJFILE (symbol),
- sympy_objfile_data_key, obj);
+ set_objfile_data (objfile, sympy_objfile_data_key, obj);
}
else
obj->next = NULL;
@@ -334,9 +333,10 @@ sympy_dealloc (PyObject *obj)
if (sym_obj->prev)
sym_obj->prev->next = sym_obj->next;
- else if (sym_obj->symbol && SYMBOL_SYMTAB (sym_obj->symbol))
+ else if (sym_obj->symbol != NULL
+ && symbol_symtab (sym_obj->symbol) != NULL)
{
- set_objfile_data (SYMBOL_OBJFILE (sym_obj->symbol),
+ set_objfile_data (symbol_objfile (sym_obj->symbol),
sympy_objfile_data_key, sym_obj->next);
}
if (sym_obj->next)
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 8b98a91..8e21d05 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -556,7 +556,7 @@ btrace_call_history_src_line (struct ui_out *uiout,
return;
ui_out_field_string (uiout, "file",
- symtab_to_filename_for_display (sym->symtab));
+ symtab_to_filename_for_display (symbol_symtab (sym)));
begin = bfun->lbegin;
end = bfun->lend;
diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 5e0cc7a..3b6639d 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -466,7 +466,7 @@ print_symbol (void *args)
struct symbol *symbol = ((struct print_symbol_args *) args)->symbol;
int depth = ((struct print_symbol_args *) args)->depth;
struct ui_file *outfile = ((struct print_symbol_args *) args)->outfile;
- struct obj_section *section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (symbol),
+ struct obj_section *section = SYMBOL_OBJ_SECTION (symbol_objfile (symbol),
symbol);
print_spaces (depth, outfile);
diff --git a/gdb/symtab.c b/gdb/symtab.c
index d64fdbd..1b9ea06 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1152,10 +1152,10 @@ fixup_symbol_section (struct symbol *sym, struct objfile *objfile)
/* We either have an OBJFILE, or we can get at it from the sym's
symtab. Anything else is a bug. */
- gdb_assert (objfile || SYMBOL_SYMTAB (sym));
+ gdb_assert (objfile || symbol_symtab (sym));
if (objfile == NULL)
- objfile = SYMBOL_OBJFILE (sym);
+ objfile = symbol_objfile (sym);
if (SYMBOL_OBJ_SECTION (objfile, sym))
return sym;
@@ -2862,10 +2862,11 @@ struct symtab_and_line
find_function_start_sal (struct symbol *sym, int funfirstline)
{
struct symtab_and_line sal;
+ struct obj_section *section;
fixup_symbol_section (sym, NULL);
- sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
- SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym), 0);
+ section = SYMBOL_OBJ_SECTION (symbol_objfile (sym), sym);
+ sal = find_pc_sect_line (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), section, 0);
/* We always should have a line for the function start address.
If we don't, something is odd. Create a plain SAL refering
@@ -2876,7 +2877,7 @@ find_function_start_sal (struct symbol *sym, int funfirstline)
init_sal (&sal);
sal.pspace = current_program_space;
sal.pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
- sal.section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
+ sal.section = section;
}
if (funfirstline)
@@ -2956,10 +2957,10 @@ skip_prologue_sal (struct symtab_and_line *sal)
{
fixup_symbol_section (sym, NULL);
+ objfile = symbol_objfile (sym);
pc = BLOCK_START (SYMBOL_BLOCK_VALUE (sym));
- section = SYMBOL_OBJ_SECTION (SYMBOL_OBJFILE (sym), sym);
+ section = SYMBOL_OBJ_SECTION (objfile, sym);
name = SYMBOL_LINKAGE_NAME (sym);
- objfile = SYMBOL_OBJFILE (sym);
}
else
{
@@ -2991,7 +2992,8 @@ skip_prologue_sal (struct symtab_and_line *sal)
/* Be conservative - allow direct PC (without skipping prologue) only if we
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 && COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (SYMBOL_SYMTAB (sym))))
+ if (sym != NULL
+ && COMPUNIT_LOCATIONS_VALID (SYMTAB_COMPUNIT (symbol_symtab (sym))))
force_skip = 0;
saved_pc = pc;
@@ -3056,7 +3058,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
is aligned. */
if (!force_skip && sym && start_sal.symtab == NULL)
{
- pc = skip_prologue_using_lineinfo (pc, SYMBOL_SYMTAB (sym));
+ pc = skip_prologue_using_lineinfo (pc, symbol_symtab (sym));
/* Recalculate the line number. */
start_sal = find_pc_sect_line (pc, section, 0);
}
@@ -3096,7 +3098,7 @@ skip_prologue_sal (struct symtab_and_line *sal)
&& SYMBOL_LINE (BLOCK_FUNCTION (function_block)) != 0)
{
sal->line = SYMBOL_LINE (BLOCK_FUNCTION (function_block));
- sal->symtab = SYMBOL_SYMTAB (BLOCK_FUNCTION (function_block));
+ sal->symtab = symbol_symtab (BLOCK_FUNCTION (function_block));
}
}
@@ -3578,8 +3580,8 @@ compare_search_syms (const void *sa, const void *sb)
struct symbol_search *sym_b = *(struct symbol_search **) sb;
int c;
- c = FILENAME_CMP (SYMBOL_SYMTAB (sym_a->symbol)->filename,
- SYMBOL_SYMTAB (sym_b->symbol)->filename);
+ c = FILENAME_CMP (symbol_symtab (sym_a->symbol)->filename,
+ symbol_symtab (sym_b->symbol)->filename);
if (c != 0)
return c;
@@ -3861,7 +3863,7 @@ search_symbols (const char *regexp, enum search_domain kind,
b = BLOCKVECTOR_BLOCK (bv, i);
ALL_BLOCK_SYMBOLS (b, iter, sym)
{
- struct symtab *real_symtab = SYMBOL_SYMTAB (sym);
+ struct symtab *real_symtab = symbol_symtab (sym);
QUIT;
@@ -3980,7 +3982,7 @@ print_symbol_info (enum search_domain kind,
struct symbol *sym,
int block, const char *last)
{
- struct symtab *s = SYMBOL_SYMTAB (sym);
+ struct symtab *s = symbol_symtab (sym);
const char *s_filename = symtab_to_filename_for_display (s);
if (last == NULL || filename_cmp (last, s_filename) != 0)
@@ -4079,7 +4081,7 @@ symtab_symbol_info (char *regexp, enum search_domain kind, int from_tty)
p->block,
last_filename);
last_filename
- = symtab_to_filename_for_display (SYMBOL_SYMTAB (p->symbol));
+ = symtab_to_filename_for_display (symbol_symtab (p->symbol));
}
}
@@ -4165,7 +4167,7 @@ rbreak_command (char *regexp, int from_tty)
{
if (p->msymbol.minsym == NULL)
{
- struct symtab *symtab = SYMBOL_SYMTAB (p->symbol);
+ struct symtab *symtab = symbol_symtab (p->symbol);
const char *fullname = symtab_to_fullname (symtab);
int newlen = (strlen (fullname)
@@ -5347,6 +5349,38 @@ allocate_template_symbol (struct objfile *objfile)
return result;
}
+/* See symtab.h. */
+
+struct objfile *
+symbol_objfile (const struct symbol *symbol)
+{
+ return SYMTAB_OBJFILE (symbol->symtab);
+}
+
+/* See symtab.h. */
+
+struct gdbarch *
+symbol_arch (const struct symbol *symbol)
+{
+ return get_objfile_arch (symbol_objfile (symbol));
+}
+
+/* See symtab.h. */
+
+struct symtab *
+symbol_symtab (const struct symbol *symbol)
+{
+ return symbol->symtab;
+}
+
+/* See symtab.h. */
+
+void
+symbol_set_symtab (struct symbol *symbol, struct symtab *symtab)
+{
+ symbol->symtab = symtab;
+}
+
void
diff --git a/gdb/symtab.h b/gdb/symtab.h
index 1446201..d195222 100644
--- a/gdb/symtab.h
+++ b/gdb/symtab.h
@@ -775,12 +775,10 @@ extern const struct symbol_impl *symbol_impls;
(symbol)->is_cplus_template_function
#define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line
-#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
#define SYMBOL_COMPUTED_OPS(symbol) (SYMBOL_IMPL (symbol).ops_computed)
#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) SYMTAB_OBJFILE (SYMBOL_SYMTAB (symbol))
extern int register_symbol_computed_impl (enum address_class,
const struct symbol_computed_ops *);
@@ -791,6 +789,28 @@ extern int register_symbol_block_impl (enum address_class aclass,
extern int register_symbol_register_impl (enum address_class,
const struct symbol_register_ops *);
+/* Return the OBJFILE of SYMBOL.
+ It is an error to call this if symbol.is_objfile_owned is false, which
+ only happens for architecture-provided types. */
+
+extern struct objfile *symbol_objfile (const struct symbol *symbol);
+
+/* Return the ARCH of SYMBOL. */
+
+extern struct gdbarch *symbol_arch (const struct symbol *symbol);
+
+/* Return the SYMTAB of SYMBOL.
+ It is an error to call this if symbol.is_objfile_owned is false, which
+ only happens for architecture-provided types. */
+
+extern struct symtab *symbol_symtab (const struct symbol *symbol);
+
+/* Set the symtab of SYMBOL to SYMTAB.
+ It is an error to call this if symbol.is_objfile_owned is false, which
+ only happens for architecture-provided types. */
+
+extern void symbol_set_symtab (struct symbol *symbol, struct symtab *symtab);
+
/* An instance of this type is used to represent a C++ template
function. It includes a "struct symbol" as a kind of base class;
users downcast to "struct template_symbol *" when needed. A symbol
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index b8ef2e1..38a3491 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2739,7 +2739,7 @@ scope_info (char *args, int from_tty)
if (symname == NULL || *symname == '\0')
continue; /* Probably botched, certainly useless. */
- gdbarch = get_objfile_arch (SYMBOL_OBJFILE (sym));
+ gdbarch = symbol_arch (sym);
printf_filtered ("Symbol %s is ", symname);
diff --git a/gdb/valops.c b/gdb/valops.c
index 2f81a59f..a6c95be 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -139,7 +139,7 @@ find_function_in_inferior (const char *name, struct objfile **objf_p)
}
if (objf_p)
- *objf_p = SYMBOL_OBJFILE (sym);
+ *objf_p = symbol_objfile (sym);
return value_of_variable (sym, NULL);
}