* coffread.c (process_coff_symbol, coff_read_enum_type): Call
allocate_symbol. * dwarf2read.c (fixup_go_packaging): Call allocate_symbol. (read_func_scope): Call allocate_template_symbol. (new_symbol_full): Call allocate_symbol. * jit.c (finalize_symtab): Call allocate_symbol. * jv-lang.c (add_class_symbol): Call allocate_symbol. * mdebugread.c (parse_symbol, new_block): Call allocate_symbol. * stabsread.c (patch_block_stabs, define_symbol, read_enum_type) (common_block_end): Call allocate_symbol. * symtab.c (allocate_symbol, initialize_symbol) (allocate_template_symbol): New functions. * symtab.c (allocate_symbol, initialize_symbol) (allocate_template_symbol): Declare. * xcoffread.c (process_xcoff_symbol): Call initialize_symbol.
This commit is contained in:
parent
5f77db5271
commit
e623cf5da2
10 changed files with 76 additions and 44 deletions
|
@ -1,3 +1,21 @@
|
|||
2013-04-08 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* coffread.c (process_coff_symbol, coff_read_enum_type): Call
|
||||
allocate_symbol.
|
||||
* dwarf2read.c (fixup_go_packaging): Call allocate_symbol.
|
||||
(read_func_scope): Call allocate_template_symbol.
|
||||
(new_symbol_full): Call allocate_symbol.
|
||||
* jit.c (finalize_symtab): Call allocate_symbol.
|
||||
* jv-lang.c (add_class_symbol): Call allocate_symbol.
|
||||
* mdebugread.c (parse_symbol, new_block): Call allocate_symbol.
|
||||
* stabsread.c (patch_block_stabs, define_symbol, read_enum_type)
|
||||
(common_block_end): Call allocate_symbol.
|
||||
* symtab.c (allocate_symbol, initialize_symbol)
|
||||
(allocate_template_symbol): New functions.
|
||||
* symtab.c (allocate_symbol, initialize_symbol)
|
||||
(allocate_template_symbol): Declare.
|
||||
* xcoffread.c (process_xcoff_symbol): Call initialize_symbol.
|
||||
|
||||
2013-04-08 Pedro Alves <palves@redhat.com>
|
||||
Keith Seitz <keiths@redhat.com>
|
||||
|
||||
|
|
|
@ -1581,12 +1581,9 @@ process_coff_symbol (struct coff_symbol *cs,
|
|||
union internal_auxent *aux,
|
||||
struct objfile *objfile)
|
||||
{
|
||||
struct symbol *sym
|
||||
= (struct symbol *) obstack_alloc (&objfile->objfile_obstack,
|
||||
sizeof (struct symbol));
|
||||
struct symbol *sym = allocate_symbol (objfile);
|
||||
char *name;
|
||||
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
name = cs->c_name;
|
||||
name = EXTERNAL_NAME (name, objfile->obfd);
|
||||
SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
|
||||
|
@ -2142,9 +2139,7 @@ coff_read_enum_type (int index, int length, int lastsym,
|
|||
switch (ms->c_sclass)
|
||||
{
|
||||
case C_MOE:
|
||||
sym = (struct symbol *) obstack_alloc
|
||||
(&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
sym = allocate_symbol (objfile);
|
||||
|
||||
SYMBOL_SET_LINKAGE_NAME (sym,
|
||||
obstack_copy0 (&objfile->objfile_obstack,
|
||||
|
|
|
@ -6952,7 +6952,7 @@ fixup_go_packaging (struct dwarf2_cu *cu)
|
|||
|
||||
TYPE_TAG_NAME (type) = TYPE_NAME (type);
|
||||
|
||||
sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_SET_LANGUAGE (sym, language_go);
|
||||
SYMBOL_SET_NAMES (sym, saved_package_name,
|
||||
strlen (saved_package_name), 0, objfile);
|
||||
|
@ -9639,8 +9639,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
|
|||
if (child_die->tag == DW_TAG_template_type_param
|
||||
|| child_die->tag == DW_TAG_template_value_param)
|
||||
{
|
||||
templ_func = OBSTACK_ZALLOC (&objfile->objfile_obstack,
|
||||
struct template_symbol);
|
||||
templ_func = allocate_template_symbol (objfile);
|
||||
templ_func->base.is_cplus_template_function = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -15972,7 +15971,7 @@ new_symbol_full (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
|
|||
if (space)
|
||||
sym = space;
|
||||
else
|
||||
sym = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
|
||||
sym = allocate_symbol (objfile);
|
||||
OBJSTAT (objfile, n_syms++);
|
||||
|
||||
/* Cache this symbol's name and the name's demangled form (if any). */
|
||||
|
|
|
@ -677,8 +677,7 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
|||
i--, gdb_block_iter = gdb_block_iter->next)
|
||||
{
|
||||
struct block *new_block = allocate_block (&objfile->objfile_obstack);
|
||||
struct symbol *block_name = obstack_alloc (&objfile->objfile_obstack,
|
||||
sizeof (struct symbol));
|
||||
struct symbol *block_name = allocate_symbol (objfile);
|
||||
struct type *block_type = arch_type (get_objfile_arch (objfile),
|
||||
TYPE_CODE_VOID,
|
||||
1,
|
||||
|
@ -691,7 +690,6 @@ finalize_symtab (struct gdb_symtab *stab, struct objfile *objfile)
|
|||
BLOCK_END (new_block) = (CORE_ADDR) gdb_block_iter->end;
|
||||
|
||||
/* The name. */
|
||||
memset (block_name, 0, sizeof (struct symbol));
|
||||
SYMBOL_DOMAIN (block_name) = VAR_DOMAIN;
|
||||
SYMBOL_ACLASS_INDEX (block_name) = LOC_BLOCK;
|
||||
SYMBOL_SYMTAB (block_name) = symtab;
|
||||
|
|
|
@ -185,9 +185,7 @@ add_class_symbol (struct type *type, CORE_ADDR addr)
|
|||
struct symbol *sym;
|
||||
struct objfile *objfile = get_dynamics_objfile (get_type_arch (type));
|
||||
|
||||
sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_SET_LANGUAGE (sym, language_java);
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, TYPE_TAG_NAME (type));
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_TYPEDEF;
|
||||
|
|
|
@ -1048,10 +1048,7 @@ parse_symbol (SYMR *sh, union aux_ext *ax, char *ext_sh, int bigend,
|
|||
FIELD_NAME (*f) = debug_info->ss + cur_fdr->issBase + tsym.iss;
|
||||
FIELD_BITSIZE (*f) = 0;
|
||||
|
||||
enum_sym = ((struct symbol *)
|
||||
obstack_alloc (&mdebugread_objfile->objfile_obstack,
|
||||
sizeof (struct symbol)));
|
||||
memset (enum_sym, 0, sizeof (struct symbol));
|
||||
enum_sym = allocate_symbol (mdebugread_objfile);
|
||||
SYMBOL_SET_LINKAGE_NAME
|
||||
(enum_sym,
|
||||
obstack_copy0 (&mdebugread_objfile->objfile_obstack,
|
||||
|
@ -4879,11 +4876,8 @@ new_block (enum block_type type)
|
|||
static struct symbol *
|
||||
new_symbol (char *name)
|
||||
{
|
||||
struct symbol *s = ((struct symbol *)
|
||||
obstack_alloc (&mdebugread_objfile->objfile_obstack,
|
||||
sizeof (struct symbol)));
|
||||
struct symbol *s = allocate_symbol (mdebugread_objfile);
|
||||
|
||||
memset (s, 0, sizeof (*s));
|
||||
SYMBOL_SET_LANGUAGE (s, psymtab_language);
|
||||
SYMBOL_SET_NAMES (s, name, strlen (name), 1, mdebugread_objfile);
|
||||
return s;
|
||||
|
|
|
@ -379,11 +379,7 @@ patch_block_stabs (struct pending *symbols, struct pending_stabs *stabs,
|
|||
/* On xcoff, if a global is defined and never referenced,
|
||||
ld will remove it from the executable. There is then
|
||||
a N_GSYM stab for it, but no regular (C_EXT) symbol. */
|
||||
sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack,
|
||||
sizeof (struct symbol));
|
||||
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_DOMAIN (sym) = VAR_DOMAIN;
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT;
|
||||
SYMBOL_SET_LINKAGE_NAME
|
||||
|
@ -652,9 +648,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
|||
e.g. ":t10=*2" or a nameless enum like " :T16=ered:0,green:1,blue:2,;" */
|
||||
nameless = (p == string || ((string[0] == ' ') && (string[1] == ':')));
|
||||
|
||||
current_symbol = sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
current_symbol = sym = allocate_symbol (objfile);
|
||||
|
||||
switch (type & N_TYPE)
|
||||
{
|
||||
|
@ -1292,8 +1286,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
|||
if (synonym)
|
||||
{
|
||||
/* Create the STRUCT_DOMAIN clone. */
|
||||
struct symbol *struct_sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
struct symbol *struct_sym = allocate_symbol (objfile);
|
||||
|
||||
*struct_sym = *sym;
|
||||
SYMBOL_ACLASS_INDEX (struct_sym) = LOC_TYPEDEF;
|
||||
|
@ -1337,8 +1330,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
|
|||
if (synonym)
|
||||
{
|
||||
/* Clone the sym and then modify it. */
|
||||
struct symbol *typedef_sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
struct symbol *typedef_sym = allocate_symbol (objfile);
|
||||
|
||||
*typedef_sym = *sym;
|
||||
SYMBOL_ACLASS_INDEX (typedef_sym) = LOC_TYPEDEF;
|
||||
|
@ -3681,9 +3673,7 @@ read_enum_type (char **pp, struct type *type,
|
|||
if (nbits != 0)
|
||||
return error_type (pp, objfile);
|
||||
|
||||
sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
sym = allocate_symbol (objfile);
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, name);
|
||||
SYMBOL_SET_LANGUAGE (sym, current_subfile->language);
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_CONST;
|
||||
|
@ -4355,9 +4345,7 @@ common_block_end (struct objfile *objfile)
|
|||
return;
|
||||
}
|
||||
|
||||
sym = (struct symbol *)
|
||||
obstack_alloc (&objfile->objfile_obstack, sizeof (struct symbol));
|
||||
memset (sym, 0, sizeof (struct symbol));
|
||||
sym = allocate_symbol (objfile);
|
||||
/* Note: common_block_name already saved on objfile_obstack. */
|
||||
SYMBOL_SET_LINKAGE_NAME (sym, common_block_name);
|
||||
SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK;
|
||||
|
|
36
gdb/symtab.c
36
gdb/symtab.c
|
@ -5119,6 +5119,42 @@ initialize_ordinary_address_classes (void)
|
|||
|
||||
|
||||
|
||||
/* Initialize the symbol SYM. */
|
||||
|
||||
void
|
||||
initialize_symbol (struct symbol *sym)
|
||||
{
|
||||
memset (sym, 0, sizeof (*sym));
|
||||
}
|
||||
|
||||
/* Allocate and initialize a new 'struct symbol' on OBJFILE's
|
||||
obstack. */
|
||||
|
||||
struct symbol *
|
||||
allocate_symbol (struct objfile *objfile)
|
||||
{
|
||||
struct symbol *result;
|
||||
|
||||
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct symbol);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Allocate and initialize a new 'struct template_symbol' on OBJFILE's
|
||||
obstack. */
|
||||
|
||||
struct template_symbol *
|
||||
allocate_template_symbol (struct objfile *objfile)
|
||||
{
|
||||
struct template_symbol *result;
|
||||
|
||||
result = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct template_symbol);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
_initialize_symtab (void)
|
||||
{
|
||||
|
|
|
@ -1363,4 +1363,10 @@ void iterate_over_symbols (const struct block *block, const char *name,
|
|||
struct cleanup *demangle_for_lookup (const char *name, enum language lang,
|
||||
const char **result_name);
|
||||
|
||||
struct symbol *allocate_symbol (struct objfile *);
|
||||
|
||||
void initialize_symbol (struct symbol *);
|
||||
|
||||
struct template_symbol *allocate_template_symbol (struct objfile *);
|
||||
|
||||
#endif /* !defined(SYMTAB_H) */
|
||||
|
|
|
@ -1546,7 +1546,7 @@ process_xcoff_symbol (struct coff_symbol *cs, struct objfile *objfile)
|
|||
if (name[0] == '.')
|
||||
++name;
|
||||
|
||||
memset (sym, '\0', sizeof (struct symbol));
|
||||
initialize_symbol (sym);
|
||||
|
||||
/* default assumptions */
|
||||
SYMBOL_VALUE_ADDRESS (sym) = cs->c_value + off;
|
||||
|
|
Loading…
Add table
Reference in a new issue