summaryrefslogtreecommitdiff
path: root/gdb/stabsread.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-08 19:48:30 +0000
committerTom Tromey <tromey@redhat.com>2013-04-08 19:48:30 +0000
commite623cf5da2730784a9062aa7ac9d6c2db37c061d (patch)
tree0d60cf4ef378d9e6a345d2cdac3251a24dc5f27b /gdb/stabsread.c
parent5f77db5271f164aec794974ebfc986d8122e71b3 (diff)
downloadbinutils-gdb-e623cf5da2730784a9062aa7ac9d6c2db37c061d.tar.gz
* 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.
Diffstat (limited to 'gdb/stabsread.c')
-rw-r--r--gdb/stabsread.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index a490bb4f0db..7939d6fc571 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -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;