+2013-03-20 Jan Kratochvil <jan.kratochvil@redhat.com>
+ Tom Tromey <tromey@redhat.com>
+
+ PR symtab/8421:
+ * coffread.c (coff_register_index): New global.
+ (process_coff_symbol, coff_read_enum_type): Set
+ SYMBOL_ACLASS_INDEX.
+ (_initialize_coffread): Initialize new global.
+ * dwarf2loc.c (locexpr_find_frame_base_location)
+ (dwarf2_block_frame_base_locexpr_funcs)
+ (loclist_find_frame_base_location)
+ (dwarf2_block_frame_base_loclist_funcs): New.
+ (dwarf_expr_frame_base_1): Call SYMBOL_BLOCK_OPS, remove internal_error.
+ (dwarf2_locexpr_funcs, dwarf2_loclist_funcs): Add location_has_loclist.
+ * dwarf2loc.h (dwarf2_block_frame_base_locexpr_funcs)
+ (dwarf2_block_frame_base_loclist_funcs): New.
+ * dwarf2read.c (dwarf2_locexpr_index, dwarf2_loclist_index)
+ (dwarf2_locexpr_block_index, dwarf2_loclist_block_index): New
+ globals.
+ (read_func_scope): Update.
+ (fixup_go_packaging, mark_common_block_symbol_computed)
+ (var_decode_location, new_symbol_full, dwarf2_const_value):
+ Set SYMBOL_ACLASS_INDEX.
+ (dwarf2_symbol_mark_computed): Likewise. Add 'is_block' argument.
+ (_initialize_dwarf2_read): Initialize new globals.
+ * jit.c (finalize_symtab): Set SYMBOL_ACLASS_INDEX.
+ * jv-lang.c (add_class_symbol): Set SYMBOL_ACLASS_INDEX.
+ * mdebugread.c (mdebug_register_index, mdebug_regparm_index): New
+ globals.
+ (parse_symbol, psymtab_to_symtab_1): Set SYMBOL_ACLASS_INDEX.
+ (_initialize_mdebugread): Initialize new globals.
+ * psympriv.h (struct partial_symbol) <aclass>: Update comment.
+ * stabsread.c (patch_block_stabs): Set SYMBOL_ACLASS_INDEX.
+ (stab_register_index, stab_regparm_index): New globals.
+ (define_symbol, read_enum_type, common_block_end): Set
+ SYMBOL_ACLASS_INDEX.
+ (_initialize_stabsread): Initialize new globals.
+ * symtab.c (next_aclass_value, symbol_impl, symbol_impls): New
+ globals.
+ (MAX_SYMBOL_IMPLS): New define.
+ (register_symbol_computed_impl, register_symbol_block_impl)
+ (register_symbol_register_impl)
+ (initialize_ordinary_address_classes): New functions.
+ (_initialize_symtab): Call initialize_ordinary_address_classes.
+ * symtab.h (enum address_class) <LOC_FINAL_VALUE>: New constant.
+ (struct symbol_impl): New.
+ (SYMBOL_ACLASS_BITS): New define.
+ (struct symbol) <aclass, ops>: Remove fields.
+ <aclass_index>: New field.
+ (symbol_impls): Declare.
+ (SYMBOL_CLASS, SYMBOL_COMPUTED_OPS, SYMBOL_REGISTER_OPS): Redefine.
+ (SYMBOL_IMPL, SYMBOL_ACLASS_INDEX): New defines.
+ (register_symbol_computed_impl, register_symbol_block_impl)
+ (register_symbol_register_impl): Declare.
+ (struct symbol_computed_ops): Add location_has_loclist.
+ (struct symbol_block_ops): New.
+ (SYMBOL_BLOCK_OPS): New.
+ * xcoffread.c (process_xcoff_symbol): Set SYMBOL_ACLASS_INDEX.
+
2013-03-20 Tom Tromey <tromey@redhat.com>
* psymtab.c (find_pc_sect_psymbol, fixup_psymbol_section)
coff_reg_to_regnum
};
+/* The "aclass" index for computed COFF symbols. */
+
+static int coff_register_index;
+
static struct symbol *
process_coff_symbol (struct coff_symbol *cs,
union internal_auxent *aux,
lookup_function_type (decode_function_type (cs, cs->c_type,
aux, objfile));
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
if (cs->c_sclass == C_STAT || cs->c_sclass == C_THUMBSTAT
|| cs->c_sclass == C_THUMBSTATFUNC)
add_symbol_to_list (sym, &file_symbols);
break;
case C_AUTO:
- SYMBOL_CLASS (sym) = LOC_LOCAL;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
add_symbol_to_list (sym, &local_symbols);
break;
case C_THUMBEXT:
case C_THUMBEXTFUNC:
case C_EXT:
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
case C_THUMBSTAT:
case C_THUMBSTATFUNC:
case C_STAT:
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = (CORE_ADDR) cs->c_value;
SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile));
case C_GLBLREG:
#endif
case C_REG:
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (sym) = &coff_register_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = coff_register_index;
SYMBOL_VALUE (sym) = cs->c_value;
add_symbol_to_list (sym, &local_symbols);
break;
break;
case C_ARG:
- SYMBOL_CLASS (sym) = LOC_ARG;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_ARG;
SYMBOL_IS_ARGUMENT (sym) = 1;
add_symbol_to_list (sym, &local_symbols);
break;
case C_REGPARM:
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (sym) = &coff_register_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = coff_register_index;
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = cs->c_value;
add_symbol_to_list (sym, &local_symbols);
break;
case C_TPDEF:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* If type has no name, give it one. */
case C_STRTAG:
case C_UNTAG:
case C_ENTAG:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
/* Some compilers try to be helpful by inventing "fake"
SYMBOL_SET_LINKAGE_NAME (sym,
obstack_copy0 (&objfile->objfile_obstack,
name, strlen (name)));
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = ms->c_value;
add_symbol_to_list (sym, symlist);
coff_objfile_data_key = register_objfile_data_with_cleanup (NULL,
coff_free_info);
+
+ coff_register_index
+ = register_symbol_register_impl (LOC_REGISTER, &coff_register_funcs);
}
start, length);
}
+/* Implement find_frame_base_location method for LOC_BLOCK functions using
+ DWARF expression for its DW_AT_frame_base. */
+
+static void
+locexpr_find_frame_base_location (struct symbol *framefunc, CORE_ADDR pc,
+ const gdb_byte **start, size_t *length)
+{
+ struct dwarf2_locexpr_baton *symbaton = SYMBOL_LOCATION_BATON (framefunc);
+
+ *length = symbaton->size;
+ *start = symbaton->data;
+}
+
+/* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
+ function uses DWARF expression for its DW_AT_frame_base. */
+
+const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs =
+{
+ locexpr_find_frame_base_location
+};
+
+/* Implement find_frame_base_location method for LOC_BLOCK functions using
+ DWARF location list for its DW_AT_frame_base. */
+
+static void
+loclist_find_frame_base_location (struct symbol *framefunc, CORE_ADDR pc,
+ const gdb_byte **start, size_t *length)
+{
+ struct dwarf2_loclist_baton *symbaton = SYMBOL_LOCATION_BATON (framefunc);
+
+ *start = dwarf2_find_location_expression (symbaton, length, pc);
+}
+
+/* Vector for inferior functions as represented by LOC_BLOCK, if the inferior
+ function uses DWARF location list for its DW_AT_frame_base. */
+
+const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs =
+{
+ loclist_find_frame_base_location
+};
+
static void
dwarf_expr_frame_base_1 (struct symbol *framefunc, CORE_ADDR pc,
const gdb_byte **start, size_t *length)
{
- if (SYMBOL_LOCATION_BATON (framefunc) == NULL)
- *length = 0;
- else if (SYMBOL_COMPUTED_OPS (framefunc) == &dwarf2_loclist_funcs)
+ if (SYMBOL_BLOCK_OPS (framefunc) != NULL)
{
- struct dwarf2_loclist_baton *symbaton;
+ const struct symbol_block_ops *ops_block = SYMBOL_BLOCK_OPS (framefunc);
- symbaton = SYMBOL_LOCATION_BATON (framefunc);
- *start = dwarf2_find_location_expression (symbaton, length, pc);
+ ops_block->find_frame_base_location (framefunc, pc, start, length);
}
else
- {
- struct dwarf2_locexpr_baton *symbaton;
-
- symbaton = SYMBOL_LOCATION_BATON (framefunc);
- if (symbaton != NULL)
- {
- *length = symbaton->size;
- *start = symbaton->data;
- }
- else
- *length = 0;
- }
+ *length = 0;
if (*length == 0)
error (_("Could not find the frame base for \"%s\"."),
locexpr_read_variable_at_entry,
locexpr_read_needs_frame,
locexpr_describe_location,
+ 0, /* location_has_loclist */
locexpr_tracepoint_var_ref
};
loclist_read_variable_at_entry,
loclist_read_needs_frame,
loclist_describe_location,
+ 1, /* location_has_loclist */
loclist_tracepoint_var_ref
};
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
extern const struct symbol_computed_ops dwarf2_loclist_funcs;
+extern const struct symbol_block_ops dwarf2_block_frame_base_locexpr_funcs;
+extern const struct symbol_block_ops dwarf2_block_frame_base_loclist_funcs;
+
/* Compile a DWARF location expression to an agent expression.
EXPR is the agent expression we are building.
static const struct objfile_data *dwarf2_objfile_data_key;
+/* The "aclass" indices for various kinds of computed DWARF symbols. */
+
+static int dwarf2_locexpr_index;
+static int dwarf2_loclist_index;
+static int dwarf2_locexpr_block_index;
+static int dwarf2_loclist_block_index;
+
struct dwarf2_section_info
{
asection *asection;
static void dwarf2_symbol_mark_computed (struct attribute *attr,
struct symbol *sym,
- struct dwarf2_cu *cu);
+ struct dwarf2_cu *cu,
+ int is_block);
static gdb_byte *skip_one_die (const struct die_reader_specs *reader,
gdb_byte *info_ptr,
/* This is not VAR_DOMAIN because we want a way to ensure a lookup of,
e.g., "main" finds the "main" module and not C's main(). */
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_TYPE (sym) = type;
add_symbol_to_list (sym, &global_symbols);
has nothing to do with the location of the function, ouch! The
relationship should be: a function's symbol has-a frame base; a
frame-base has-a location expression. */
- dwarf2_symbol_mark_computed (attr, new->name, cu);
+ dwarf2_symbol_mark_computed (attr, new->name, cu, 1);
cu->list_in_scope = &local_symbols;
*ptr++ = DW_OP_plus;
gdb_assert (ptr - baton->data == baton->size);
- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs;
SYMBOL_LOCATION_BATON (sym) = baton;
- SYMBOL_CLASS (sym) = LOC_COMPUTED;
+ SYMBOL_ACLASS_INDEX (sym) = dwarf2_locexpr_index;
}
/* Create appropriate locally-scoped variables for all the
variable has been optimized away. */
if (attr_form_is_block (attr) && DW_BLOCK (attr)->size == 0)
{
- SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
return;
}
else
SYMBOL_VALUE_ADDRESS (sym) =
read_addr_index_from_leb128 (cu, DW_BLOCK (attr)->data + 1, &dummy);
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
fixup_symbol_section (sym, objfile);
SYMBOL_VALUE_ADDRESS (sym) += ANOFFSET (objfile->section_offsets,
SYMBOL_SECTION (sym));
not be worthwhile. I'm assuming that it isn't unless performance
or memory numbers show me otherwise. */
- dwarf2_symbol_mark_computed (attr, sym, cu);
- SYMBOL_CLASS (sym) = LOC_COMPUTED;
+ dwarf2_symbol_mark_computed (attr, sym, cu, 0);
- if (SYMBOL_COMPUTED_OPS (sym) == &dwarf2_loclist_funcs)
+ if (SYMBOL_COMPUTED_OPS (sym)->location_has_loclist)
cu->has_loclist = 1;
}
/* Default assumptions.
Use the passed type or decode it from the die. */
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
if (type != NULL)
SYMBOL_TYPE (sym) = type;
else
}
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_core_addr;
SYMBOL_DOMAIN (sym) = LABEL_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_LABEL;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL;
add_symbol_to_list (sym, cu->list_in_scope);
break;
case DW_TAG_subprogram:
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
finish_block. */
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
attr2 = dwarf2_attr (die, DW_AT_external, cu);
if ((attr2 && (DW_UNSND (attr2) != 0))
|| cu->language == language_ada)
case DW_TAG_inlined_subroutine:
/* SYMBOL_BLOCK_VALUE (sym) will be filled in later by
finish_block. */
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_INLINED (sym) = 1;
list_to_add = cu->list_in_scope;
break;
&& die->parent->tag == DW_TAG_module
&& cu->producer
&& strncmp (cu->producer, "GNU Fortran ", 12) == 0)
- SYMBOL_CLASS (sym) = LOC_UNRESOLVED;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED;
/* A variable with DW_AT_external is never static,
but it may be block-scoped. */
list_to_add = (cu->list_in_scope == &file_symbols
? &global_symbols : cu->list_in_scope);
- SYMBOL_CLASS (sym) = LOC_UNRESOLVED;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_UNRESOLVED;
}
else if (!die_is_declaration (die, cu))
{
case DW_TAG_union_type:
case DW_TAG_set_type:
case DW_TAG_enumeration_type:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
{
}
break;
case DW_TAG_typedef:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
list_to_add = cu->list_in_scope;
break;
case DW_TAG_base_type:
case DW_TAG_subrange_type:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
list_to_add = cu->list_in_scope;
break;
}
break;
case DW_TAG_namespace:
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
list_to_add = &global_symbols;
break;
case DW_TAG_common_block:
- SYMBOL_CLASS (sym) = LOC_COMMON_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_COMMON_BLOCK;
SYMBOL_DOMAIN (sym) = COMMON_BLOCK_DOMAIN;
add_symbol_to_list (sym, cu->list_in_scope);
break;
if (baton != NULL)
{
- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs;
SYMBOL_LOCATION_BATON (sym) = baton;
- SYMBOL_CLASS (sym) = LOC_COMPUTED;
+ SYMBOL_ACLASS_INDEX (sym) = dwarf2_locexpr_index;
}
else if (bytes != NULL)
{
SYMBOL_VALUE_BYTES (sym) = bytes;
- SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES;
}
else
{
SYMBOL_VALUE (sym) = value;
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
}
}
static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
- struct dwarf2_cu *cu)
+ struct dwarf2_cu *cu, int is_block)
{
struct objfile *objfile = dwarf2_per_objfile->objfile;
struct dwarf2_section_info *section = cu_debug_loc_section (cu);
_("Location list used without "
"specifying the CU base address."));
- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_loclist_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = (is_block
+ ? dwarf2_loclist_block_index
+ : dwarf2_loclist_index);
SYMBOL_LOCATION_BATON (sym) = baton;
}
else
baton->size = 0;
}
- SYMBOL_COMPUTED_OPS (sym) = &dwarf2_locexpr_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = (is_block
+ ? dwarf2_locexpr_block_index
+ : dwarf2_locexpr_index);
SYMBOL_LOCATION_BATON (sym) = baton;
}
}
Usage: save gdb-index DIRECTORY"),
&save_cmdlist);
set_cmd_completer (c, filename_completer);
+
+ dwarf2_locexpr_index = register_symbol_computed_impl (LOC_COMPUTED,
+ &dwarf2_locexpr_funcs);
+ dwarf2_loclist_index = register_symbol_computed_impl (LOC_COMPUTED,
+ &dwarf2_loclist_funcs);
+
+ dwarf2_locexpr_block_index = register_symbol_block_impl (LOC_BLOCK,
+ &dwarf2_block_frame_base_locexpr_funcs);
+ dwarf2_loclist_block_index = register_symbol_block_impl (LOC_BLOCK,
+ &dwarf2_block_frame_base_loclist_funcs);
}
/* The name. */
memset (block_name, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
- SYMBOL_CLASS (block_name) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (block_name) = LOC_BLOCK;
SYMBOL_SYMTAB (block_name) = symtab;
SYMBOL_TYPE (block_name) = lookup_function_type (block_type);
SYMBOL_BLOCK_VALUE (block_name) = new_block;
memset (sym, 0, sizeof (struct symbol));
SYMBOL_SET_LANGUAGE (sym, language_java);
SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
/* SYMBOL_VALUE (sym) = valu; */
SYMBOL_TYPE (sym) = type;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
mdebug_reg_to_regnum
};
+/* The "aclass" indices for computed symbols. */
+
+static int mdebug_register_index;
+static int mdebug_regparm_index;
+
static int
parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
struct section_offsets *section_offsets, struct objfile *objfile)
s = new_symbol (name);
SYMBOL_VALUE (s) = svalue;
if (sh->sc == scRegister)
- {
- class = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (s) = &mdebug_register_funcs;
- }
+ class = mdebug_register_index;
else
class = LOC_LOCAL;
data: /* Common code for symbols describing data. */
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
- SYMBOL_CLASS (s) = class;
+ SYMBOL_ACLASS_INDEX (s) = class;
add_symbol (s, top_stack->cur_st, b);
/* Type could be missing if file is compiled without debugging info. */
{
case scRegister:
/* Pass by value in register. */
- SYMBOL_CLASS (s) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (s) = &mdebug_register_funcs;
+ SYMBOL_ACLASS_INDEX (s) = mdebug_register_index;
break;
case scVar:
/* Pass by reference on stack. */
- SYMBOL_CLASS (s) = LOC_REF_ARG;
+ SYMBOL_ACLASS_INDEX (s) = LOC_REF_ARG;
break;
case scVarRegister:
/* Pass by reference in register. */
- SYMBOL_CLASS (s) = LOC_REGPARM_ADDR;
- SYMBOL_REGISTER_OPS (s) = &mdebug_register_funcs;
+ SYMBOL_ACLASS_INDEX (s) = mdebug_regparm_index;
break;
default:
/* Pass by value on stack. */
- SYMBOL_CLASS (s) = LOC_ARG;
+ SYMBOL_ACLASS_INDEX (s) = LOC_ARG;
break;
}
SYMBOL_VALUE (s) = svalue;
case stLabel: /* label, goes into current block. */
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN; /* So that it can be used */
- SYMBOL_CLASS (s) = LOC_LABEL; /* but not misused. */
+ SYMBOL_ACLASS_INDEX (s) = LOC_LABEL; /* but not misused. */
SYMBOL_VALUE_ADDRESS (s) = (CORE_ADDR) sh->value;
SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_int;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
}
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
- SYMBOL_CLASS (s) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (s) = LOC_BLOCK;
/* Type of the return value. */
if (SC_IS_UNDEF (sh->sc) || sh->sc == scNil)
t = objfile_type (objfile)->builtin_int;
(enum_sym,
obstack_copy0 (&mdebugread_objfile->objfile_obstack,
f->name, strlen (f->name)));
- SYMBOL_CLASS (enum_sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (enum_sym) = LOC_CONST;
SYMBOL_TYPE (enum_sym) = t;
SYMBOL_DOMAIN (enum_sym) = VAR_DOMAIN;
SYMBOL_VALUE (enum_sym) = tsym.value;
s = new_symbol (name);
SYMBOL_DOMAIN (s) = STRUCT_DOMAIN;
- SYMBOL_CLASS (s) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (s) = LOC_TYPEDEF;
SYMBOL_VALUE (s) = 0;
SYMBOL_TYPE (s) = t;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
/* Make up special symbol to contain procedure specific info. */
s = new_symbol (MDEBUG_EFI_SYMBOL_NAME);
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
- SYMBOL_CLASS (s) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (s) = LOC_CONST;
SYMBOL_TYPE (s) = objfile_type (mdebugread_objfile)->builtin_void;
e = ((struct mdebug_extra_func_info *)
obstack_alloc (&mdebugread_objfile->objfile_obstack,
break;
s = new_symbol (name);
SYMBOL_DOMAIN (s) = VAR_DOMAIN;
- SYMBOL_CLASS (s) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (s) = LOC_TYPEDEF;
SYMBOL_BLOCK_VALUE (s) = top_stack->cur_block;
SYMBOL_TYPE (s) = t;
add_symbol (s, top_stack->cur_st, top_stack->cur_block);
memset (e, 0, sizeof (struct mdebug_extra_func_info));
SYMBOL_DOMAIN (s) = LABEL_DOMAIN;
- SYMBOL_CLASS (s) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (s) = LOC_CONST;
SYMBOL_TYPE (s) = objfile_type (objfile)->builtin_void;
SYMBOL_VALUE_BYTES (s) = (gdb_byte *) e;
e->pdr.framereg = -1;
_initialize_mdebugread (void)
{
basic_type_data = register_objfile_data ();
+
+ mdebug_register_index
+ = register_symbol_register_impl (LOC_REGISTER, &mdebug_register_funcs);
+ mdebug_regparm_index
+ = register_symbol_register_impl (LOC_REGPARM_ADDR, &mdebug_register_funcs);
}
ENUM_BITFIELD(domain_enum_tag) domain : 6;
- /* Address class (for info_symbols). */
+ /* Address class (for info_symbols). Note that we don't allow
+ synthetic "aclass" values here at present, simply because there's
+ no need. */
ENUM_BITFIELD(address_class) aclass : 6;
memset (sym, 0, sizeof (struct symbol));
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
- SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
SYMBOL_SET_LINKAGE_NAME
(sym, obstack_copy0 (&objfile->objfile_obstack,
name, pp - name));
stab_reg_to_regnum
};
+/* The "aclass" indices for computed symbols. */
+
+static int stab_register_index;
+static int stab_regparm_index;
+
struct symbol *
define_symbol (CORE_ADDR valu, char *string, int desc, int type,
struct objfile *objfile)
(where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
if (*p != '=')
{
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
SYMBOL_TYPE (sym) = dbl_type;
SYMBOL_VALUE_BYTES (sym) = dbl_valu;
- SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES;
}
break;
case 'i':
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_long;
SYMBOL_VALUE (sym) = atoi (p);
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
}
break;
{
SYMBOL_TYPE (sym) = objfile_type (objfile)->builtin_char;
SYMBOL_VALUE (sym) = atoi (p);
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
}
break;
if (quote != '\'' && quote != '"')
{
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
}
if (*p != quote)
{
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
p++;
SYMBOL_VALUE_BYTES (sym) = string_value;
- SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES;
}
break;
e.g. "b:c=e6,0" for "const b = blob1"
(where type 6 is defined by "blobs:t6=eblob1:0,blob2:1,;"). */
{
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = read_type (&p, objfile);
if (*p != ',')
break;
default:
{
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_TYPE (sym) = error_type (&p, objfile);
}
}
case 'C':
/* The name of a caught exception. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_LABEL;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_LABEL;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE_ADDRESS (sym) = valu;
add_symbol_to_list (sym, &local_symbols);
case 'f':
/* A static function definition. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
/* fall into process_function_types. */
case 'F':
/* A global function definition. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &global_symbols);
goto process_function_types;
corresponding linker definition to find the value.
These definitions appear at the end of the namelist. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* Don't add symbol references to global_sym_chain.
Symbol references don't have valid names and wont't match up with
case 's':
case 'l':
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_LOCAL;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &local_symbols);
else
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_ARG;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_ARG;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_IS_ARGUMENT (sym) = 1;
case 'R':
/* Parameter which is in a register. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = stab_register_index;
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
case 'r':
/* Register variable (either global or local). */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = stab_register_index;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
if (within_function)
&& strcmp (SYMBOL_LINKAGE_NAME (prev_sym),
SYMBOL_LINKAGE_NAME (sym)) == 0)
{
- SYMBOL_CLASS (prev_sym) = LOC_REGISTER;
- SYMBOL_REGISTER_OPS (prev_sym) = &stab_register_funcs;
+ SYMBOL_ACLASS_INDEX (prev_sym) = stab_register_index;
/* Use the type from the LOC_REGISTER; that is the type
that is actually in that register. */
SYMBOL_TYPE (prev_sym) = SYMBOL_TYPE (sym);
case 'S':
/* Static symbol at top level of file. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
if (gdbarch_static_transform_name_p (gdbarch)
&& gdbarch_static_transform_name (gdbarch,
if (nameless)
return NULL;
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
/* C++ vagaries: we may have a type which is derived from
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
*struct_sym = *sym;
- SYMBOL_CLASS (struct_sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (struct_sym) = valu;
SYMBOL_DOMAIN (struct_sym) = STRUCT_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
if (nameless)
return NULL;
- SYMBOL_CLASS (sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
*typedef_sym = *sym;
- SYMBOL_CLASS (typedef_sym) = LOC_TYPEDEF;
+ SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
SYMBOL_VALUE (typedef_sym) = valu;
SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
case 'V':
/* Static symbol of local scope. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_STATIC;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_STATIC;
SYMBOL_VALUE_ADDRESS (sym) = valu;
if (gdbarch_static_transform_name_p (gdbarch)
&& gdbarch_static_transform_name (gdbarch,
case 'v':
/* Reference parameter */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_REF_ARG;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_REF_ARG;
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
case 'a':
/* Reference parameter which is in a register. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
- SYMBOL_REGISTER_OPS (sym) = &stab_register_funcs;
+ SYMBOL_ACLASS_INDEX (sym) = stab_regparm_index;
SYMBOL_IS_ARGUMENT (sym) = 1;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
that Pascal uses it too, but when I tried it Pascal used
"x:3" (local symbol) instead. */
SYMBOL_TYPE (sym) = read_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_LOCAL;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_LOCAL;
SYMBOL_VALUE (sym) = valu;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &local_symbols);
default:
SYMBOL_TYPE (sym) = error_type (&p, objfile);
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_VALUE (sym) = 0;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
add_symbol_to_list (sym, &file_symbols);
/* We have to convert LOC_REGISTER to LOC_REGPARM_ADDR (for
variables passed in a register). */
if (SYMBOL_CLASS (sym) == LOC_REGISTER)
- SYMBOL_CLASS (sym) = LOC_REGPARM_ADDR;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_REGPARM_ADDR;
/* Likewise for converting LOC_ARG to LOC_REF_ARG (for the 7th
and subsequent arguments on SPARC, for example). */
else if (SYMBOL_CLASS (sym) == LOC_ARG)
- SYMBOL_CLASS (sym) = LOC_REF_ARG;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_REF_ARG;
}
return sym;
memset (sym, 0, sizeof (struct symbol));
SYMBOL_SET_LINKAGE_NAME (sym, name);
SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
- SYMBOL_CLASS (sym) = LOC_CONST;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
SYMBOL_VALUE (sym) = n;
if (n < 0)
memset (sym, 0, sizeof (struct symbol));
/* Note: common_block_name already saved on objfile_obstack. */
SYMBOL_SET_LINKAGE_NAME (sym, common_block_name);
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
/* Now we copy all the symbols which have been defined since the BCOMM. */
/* Complain about unresolved common block symbols. */
if (SYMBOL_CLASS (prev) == LOC_STATIC)
- SYMBOL_CLASS (prev) = LOC_UNRESOLVED;
+ SYMBOL_ACLASS_INDEX (prev) = LOC_UNRESOLVED;
else
complaint (&symfile_complaints,
_("%s: common block `%s' from "
noname_undefs_length = 0;
noname_undefs = (struct nat *)
xmalloc (noname_undefs_allocated * sizeof (struct nat));
+
+ stab_register_index = register_symbol_register_impl (LOC_REGISTER,
+ &stab_register_funcs);
+ stab_regparm_index = register_symbol_register_impl (LOC_REGPARM_ADDR,
+ &stab_register_funcs);
}
return 0;
}
+\f
+
+/* The next index to hand out in response to a registration request. */
+
+static int next_aclass_value = LOC_FINAL_VALUE;
+
+/* The maximum number of "aclass" registrations we support. This is
+ constant for convenience. */
+#define MAX_SYMBOL_IMPLS (LOC_FINAL_VALUE + 10)
+
+/* The objects representing the various "aclass" values. The elements
+ from 0 up to LOC_FINAL_VALUE-1 represent themselves, and subsequent
+ elements are those registered at gdb initialization time. */
+
+static struct symbol_impl symbol_impl[MAX_SYMBOL_IMPLS];
+
+/* The globally visible pointer. This is separate from 'symbol_impl'
+ so that it can be const. */
+
+const struct symbol_impl *symbol_impls = &symbol_impl[0];
+
+/* Make sure we saved enough room in struct symbol. */
+
+gdb_static_assert (MAX_SYMBOL_IMPLS <= (1 << SYMBOL_ACLASS_BITS));
+
+/* Register a computed symbol type. ACLASS must be LOC_COMPUTED. OPS
+ is the ops vector associated with this index. This returns the new
+ index, which should be used as the aclass_index field for symbols
+ of this type. */
+
+int
+register_symbol_computed_impl (enum address_class aclass,
+ const struct symbol_computed_ops *ops)
+{
+ int result = next_aclass_value++;
+
+ gdb_assert (aclass == LOC_COMPUTED);
+ gdb_assert (result < MAX_SYMBOL_IMPLS);
+ symbol_impl[result].aclass = aclass;
+ symbol_impl[result].ops_computed = ops;
+
+ return result;
+}
+
+/* Register a function with frame base type. ACLASS must be LOC_BLOCK.
+ OPS is the ops vector associated with this index. This returns the
+ new index, which should be used as the aclass_index field for symbols
+ of this type. */
+
+int
+register_symbol_block_impl (enum address_class aclass,
+ const struct symbol_block_ops *ops)
+{
+ int result = next_aclass_value++;
+
+ gdb_assert (aclass == LOC_BLOCK);
+ gdb_assert (result < MAX_SYMBOL_IMPLS);
+ symbol_impl[result].aclass = aclass;
+ symbol_impl[result].ops_block = ops;
+
+ /* Sanity check OPS. */
+ gdb_assert (ops != NULL);
+ gdb_assert (ops->find_frame_base_location != NULL);
+
+ return result;
+}
+
+/* Register a register symbol type. ACLASS must be LOC_REGISTER or
+ LOC_REGPARM_ADDR. OPS is the register ops vector associated with
+ this index. This returns the new index, which should be used as
+ the aclass_index field for symbols of this type. */
+
+int
+register_symbol_register_impl (enum address_class aclass,
+ const struct symbol_register_ops *ops)
+{
+ int result = next_aclass_value++;
+
+ gdb_assert (aclass == LOC_REGISTER || aclass == LOC_REGPARM_ADDR);
+ gdb_assert (result < MAX_SYMBOL_IMPLS);
+ symbol_impl[result].aclass = aclass;
+ symbol_impl[result].ops_register = ops;
+
+ return result;
+}
+
+/* Initialize elements of 'symbol_impl' for the constants in enum
+ address_class. */
+
+static void
+initialize_ordinary_address_classes (void)
+{
+ int i;
+
+ for (i = 0; i < LOC_FINAL_VALUE; ++i)
+ symbol_impl[i].aclass = i;
+}
+
+\f
+
void
_initialize_symtab (void)
{
+ initialize_ordinary_address_classes ();
+
add_info ("variables", variables_info, _("\
All global and static variable names, or those matching REGEXP."));
if (dbx_commands)
/* The variable uses general_symbol_info->value->common_block field.
It also always uses COMMON_BLOCK_DOMAIN. */
LOC_COMMON_BLOCK,
+
+ /* Not used, just notes the boundary of the enum. */
+ LOC_FINAL_VALUE
};
/* The methods needed to implement LOC_COMPUTED. These methods can
void (*describe_location) (struct symbol * symbol, CORE_ADDR addr,
struct ui_file * stream);
+ /* Non-zero if this symbol's address computation is dependent on PC. */
+ unsigned char location_has_loclist;
+
/* Tracepoint support. Append bytecodes to the tracepoint agent
expression AX that push the address of the object SYMBOL. Set
VALUE appropriately. Note --- for objects in registers, this
struct agent_expr *ax, struct axs_value *value);
};
+/* The methods needed to implement LOC_BLOCK for inferior functions.
+ These methods can use the symbol's .aux_value for additional
+ per-symbol information. */
+
+struct symbol_block_ops
+{
+ /* Fill in *START and *LENGTH with DWARF block data of function
+ FRAMEFUNC valid for inferior context address PC. Set *LENGTH to
+ zero if such location is not valid for PC; *START is left
+ uninitialized in such case. */
+ void (*find_frame_base_location) (struct symbol *framefunc, CORE_ADDR pc,
+ const gdb_byte **start, size_t *length);
+};
+
/* Functions used with LOC_REGISTER and LOC_REGPARM_ADDR. */
struct symbol_register_ops
int (*register_number) (struct symbol *symbol, struct gdbarch *gdbarch);
};
+/* Objects of this type are used to find the address class and the
+ various computed ops vectors of a symbol. */
+
+struct symbol_impl
+{
+ enum address_class aclass;
+
+ /* Used with LOC_COMPUTED. */
+ const struct symbol_computed_ops *ops_computed;
+
+ /* Used with LOC_BLOCK. */
+ const struct symbol_block_ops *ops_block;
+
+ /* Used with LOC_REGISTER and LOC_REGPARM_ADDR. */
+ const struct symbol_register_ops *ops_register;
+};
+
+/* The number of bits we reserve in a symbol for the aclass index.
+ This is a #define so that we can have a assertion elsewhere to
+ verify that we have reserved enough space for synthetic address
+ classes. */
+
+#define SYMBOL_ACLASS_BITS 6
+
/* This structure is space critical. See space comments at the top. */
struct symbol
ENUM_BITFIELD(domain_enum_tag) domain : 6;
- /* Address class */
- /* NOTE: cagney/2003-11-02: The fields "aclass" and "ops" contain
- overlapping information. By creating a per-aclass ops vector, or
- using the aclass as an index into an ops table, the aclass and
- ops fields can be merged. The latter, for instance, would shave
- 32-bits from each symbol (relative to a symbol lookup, any table
- index overhead would be in the noise). */
+ /* Address class. This holds an index into the 'symbol_impls'
+ table. The actual enum address_class value is stored there,
+ alongside any per-class ops vectors. */
- ENUM_BITFIELD(address_class) aclass : 6;
+ unsigned int aclass_index : SYMBOL_ACLASS_BITS;
/* Whether this is an argument. */
unsigned short line;
- /* Method's for symbol's of this class. */
- /* NOTE: cagney/2003-11-02: See comment above attached to "aclass". */
-
- union
- {
- /* Used with LOC_COMPUTED. */
- const struct symbol_computed_ops *ops_computed;
-
- /* Used with LOC_REGISTER and LOC_REGPARM_ADDR. */
- const struct symbol_register_ops *ops_register;
- } ops;
-
/* An arbitrary data pointer, allowing symbol readers to record
additional information on a per-symbol basis. Note that this data
must be allocated using the same obstack as the symbol itself. */
struct symbol *hash_next;
};
+extern const struct symbol_impl *symbol_impls;
#define SYMBOL_DOMAIN(symbol) (symbol)->domain
-#define SYMBOL_CLASS(symbol) (symbol)->aclass
+#define SYMBOL_IMPL(symbol) (symbol_impls[(symbol)->aclass_index])
+#define SYMBOL_ACLASS_INDEX(symbol) (symbol)->aclass_index
+#define SYMBOL_CLASS(symbol) (SYMBOL_IMPL (symbol).aclass)
#define SYMBOL_IS_ARGUMENT(symbol) (symbol)->is_argument
#define SYMBOL_INLINED(symbol) (symbol)->is_inlined
#define SYMBOL_IS_CPLUS_TEMPLATE_FUNCTION(symbol) \
#define SYMBOL_TYPE(symbol) (symbol)->type
#define SYMBOL_LINE(symbol) (symbol)->line
#define SYMBOL_SYMTAB(symbol) (symbol)->symtab
-#define SYMBOL_COMPUTED_OPS(symbol) (symbol)->ops.ops_computed
-#define SYMBOL_REGISTER_OPS(symbol) (symbol)->ops.ops_register
+#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
+extern int register_symbol_computed_impl (enum address_class,
+ const struct symbol_computed_ops *);
+
+extern int register_symbol_block_impl (enum address_class aclass,
+ const struct symbol_block_ops *ops);
+
+extern int register_symbol_register_impl (enum address_class,
+ const struct symbol_register_ops *);
+
/* 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
SYMBOL_SET_LINKAGE_NAME (sym, SYMNAME_ALLOC (name, symname_alloced));
SYMBOL_TYPE (sym) = objfile_type (objfile)->nodebug_text_symbol;
- SYMBOL_CLASS (sym) = LOC_BLOCK;
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
SYMBOL_DUP (sym, sym2);
if (cs->c_sclass == C_EXT)