diff options
author | Doug Evans <xdje42@gmail.com> | 2014-12-23 07:21:10 -0800 |
---|---|---|
committer | Doug Evans <xdje42@gmail.com> | 2014-12-23 07:21:10 -0800 |
commit | 08be3fe322244a3684d007d9282e225fc215f5d8 (patch) | |
tree | 083e30284643e51dbc49b6b3ab9a3e3a5a0e6e35 /gdb/symtab.c | |
parent | 4347085ad3e84bdc1f91e7121cedf3e79a9467fb (diff) | |
download | gdb-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.
Diffstat (limited to 'gdb/symtab.c')
-rw-r--r-- | gdb/symtab.c | 66 |
1 files changed, 50 insertions, 16 deletions
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 |