Index: gdb/stabsread.c |
diff --git a/gdb/stabsread.c b/gdb/stabsread.c |
index eb09c9d5997dfb9a43bc9a96ca5090e4c33a7749..00467725996b16b3c431e87cd1a2d03b5d7335ff 100644 |
--- a/gdb/stabsread.c |
+++ b/gdb/stabsread.c |
@@ -1,6 +1,6 @@ |
/* Support routines for decoding "stabs" debugging information format. |
- Copyright (C) 1986-2012 Free Software Foundation, Inc. |
+ Copyright (C) 1986-2013 Free Software Foundation, Inc. |
This file is part of GDB. |
@@ -24,7 +24,7 @@ |
Avoid placing any object file format specific code in this file. */ |
#include "defs.h" |
-#include "gdb_string.h" |
+#include <string.h> |
#include "bfd.h" |
#include "gdb_obstack.h" |
#include "symtab.h" |
@@ -207,6 +207,23 @@ static int noname_undefs_length; |
if (**(pp) == '\\' || (**(pp) == '?' && (*(pp))[1] == '\0')) \ |
*(pp) = next_symbol_text (objfile); \ |
} while (0) |
+ |
+/* Vector of types defined so far, indexed by their type numbers. |
+ (In newer sun systems, dbx uses a pair of numbers in parens, |
+ as in "(SUBFILENUM,NUMWITHINSUBFILE)". |
+ Then these numbers must be translated through the type_translations |
+ hash table to get the index into the type vector.) */ |
+ |
+static struct type **type_vector; |
+ |
+/* Number of elements allocated for type_vector currently. */ |
+ |
+static int type_vector_length; |
+ |
+/* Initial size of type vector. Is realloc'd larger if needed, and |
+ realloc'd down to the size actually used, when completed. */ |
+ |
+#define INITIAL_TYPE_VECTOR_LENGTH 160 |
/* Look up a dbx type-number pair. Return the address of the slot |
@@ -379,16 +396,12 @@ 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_CLASS (sym) = LOC_OPTIMIZED_OUT; |
+ SYMBOL_ACLASS_INDEX (sym) = LOC_OPTIMIZED_OUT; |
SYMBOL_SET_LINKAGE_NAME |
- (sym, obsavestring (name, pp - name, |
- &objfile->objfile_obstack)); |
+ (sym, obstack_copy0 (&objfile->objfile_obstack, |
+ name, pp - name)); |
pp += 2; |
if (*(pp - 1) == 'F' || *(pp - 1) == 'f') |
{ |
@@ -604,6 +617,11 @@ static const struct symbol_register_ops stab_register_funcs = { |
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) |
@@ -647,22 +665,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)); |
- |
- switch (type & N_TYPE) |
- { |
- case N_TEXT: |
- SYMBOL_SECTION (sym) = SECT_OFF_TEXT (objfile); |
- break; |
- case N_DATA: |
- SYMBOL_SECTION (sym) = SECT_OFF_DATA (objfile); |
- break; |
- case N_BSS: |
- SYMBOL_SECTION (sym) = SECT_OFF_BSS (objfile); |
- break; |
- } |
+ current_symbol = sym = allocate_symbol (objfile); |
if (processing_gcc_compilation) |
{ |
@@ -710,7 +713,8 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
else |
{ |
normal: |
- SYMBOL_SET_LANGUAGE (sym, current_subfile->language); |
+ SYMBOL_SET_LANGUAGE (sym, current_subfile->language, |
+ &objfile->objfile_obstack); |
if (SYMBOL_LANGUAGE (sym) == language_cplus) |
{ |
char *name = alloca (p - string + 1); |
@@ -761,7 +765,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
(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); |
@@ -788,7 +792,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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': |
@@ -802,7 +806,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -810,7 +814,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
{ |
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; |
@@ -824,7 +828,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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); |
@@ -849,7 +853,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
} |
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); |
@@ -870,7 +874,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
p++; |
SYMBOL_VALUE_BYTES (sym) = string_value; |
- SYMBOL_CLASS (sym) = LOC_CONST_BYTES; |
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST_BYTES; |
} |
break; |
@@ -880,7 +884,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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 != ',') |
@@ -901,7 +905,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
break; |
default: |
{ |
- SYMBOL_CLASS (sym) = LOC_CONST; |
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; |
SYMBOL_TYPE (sym) = error_type (&p, objfile); |
} |
} |
@@ -912,7 +916,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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); |
@@ -921,7 +925,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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. */ |
@@ -992,7 +996,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -1003,7 +1007,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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 |
@@ -1024,7 +1028,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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); |
@@ -1044,7 +1048,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -1092,8 +1096,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -1103,8 +1106,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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) |
@@ -1141,8 +1143,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
&& 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); |
@@ -1160,7 +1161,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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, |
@@ -1209,7 +1210,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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 |
@@ -1290,11 +1291,10 @@ 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_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) |
@@ -1322,7 +1322,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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) |
@@ -1335,11 +1335,10 @@ 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_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) |
@@ -1354,7 +1353,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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, |
@@ -1381,7 +1380,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -1391,8 +1390,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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; |
@@ -1405,7 +1403,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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); |
@@ -1413,7 +1411,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
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); |
@@ -1430,11 +1428,11 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, |
/* 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; |
@@ -1632,8 +1630,8 @@ again: |
new_name = cp_canonicalize_string (name); |
if (new_name != NULL) |
{ |
- type_name = obsavestring (new_name, strlen (new_name), |
- &objfile->objfile_obstack); |
+ type_name = obstack_copy0 (&objfile->objfile_obstack, |
+ new_name, strlen (new_name)); |
xfree (new_name); |
} |
} |
@@ -2024,11 +2022,9 @@ again: |
make_vector_type (type); |
break; |
- case 'S': /* Set or bitstring type */ |
+ case 'S': /* Set type */ |
type1 = read_type (pp, objfile); |
type = create_set_type ((struct type *) NULL, type1); |
- if (is_string) |
- TYPE_CODE (type) = TYPE_CODE_BITSTRING; |
if (typenums[0] != -1) |
*dbx_lookup_type (typenums, objfile) = type; |
break; |
@@ -2714,8 +2710,8 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, |
dem_opname, 0); |
if (ret) |
new_fnlist->fn_fieldlist.name |
- = obsavestring (dem_opname, strlen (dem_opname), |
- &objfile->objfile_obstack); |
+ = obstack_copy0 (&objfile->objfile_obstack, |
+ dem_opname, strlen (dem_opname)); |
xfree (main_fn_name); |
} |
@@ -2857,7 +2853,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, |
struct gdbarch *gdbarch = get_objfile_arch (objfile); |
fip->list->field.name = |
- obsavestring (*pp, p - *pp, &objfile->objfile_obstack); |
+ obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp); |
*pp = p + 1; |
/* This means we have a visibility for a field coming. */ |
@@ -3536,7 +3532,10 @@ read_struct_type (char **pp, struct type *type, enum type_code type_code, |
TYPE_LENGTH (type) = read_huge_number (pp, 0, &nbits, 0); |
if (nbits != 0) |
- return error_type (pp, objfile); |
+ { |
+ do_cleanups (back_to); |
+ return error_type (pp, objfile); |
+ } |
set_length_in_type_chain (type); |
} |
@@ -3676,18 +3675,17 @@ read_enum_type (char **pp, struct type *type, |
p = *pp; |
while (*p != ':') |
p++; |
- name = obsavestring (*pp, p - *pp, &objfile->objfile_obstack); |
+ name = obstack_copy0 (&objfile->objfile_obstack, *pp, p - *pp); |
*pp = p + 1; |
n = read_huge_number (pp, ',', &nbits, 0); |
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_CLASS (sym) = LOC_CONST; |
+ SYMBOL_SET_LANGUAGE (sym, current_subfile->language, |
+ &objfile->objfile_obstack); |
+ SYMBOL_ACLASS_INDEX (sym) = LOC_CONST; |
SYMBOL_DOMAIN (sym) = VAR_DOMAIN; |
SYMBOL_VALUE (sym) = n; |
if (n < 0) |
@@ -4330,8 +4328,8 @@ common_block_start (char *name, struct objfile *objfile) |
} |
common_block = local_symbols; |
common_block_i = local_symbols ? local_symbols->nsyms : 0; |
- common_block_name = obsavestring (name, strlen (name), |
- &objfile->objfile_obstack); |
+ common_block_name = obstack_copy0 (&objfile->objfile_obstack, |
+ name, strlen (name)); |
} |
/* Process a N_ECOMM symbol. */ |
@@ -4356,12 +4354,10 @@ 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_CLASS (sym) = LOC_BLOCK; |
+ SYMBOL_ACLASS_INDEX (sym) = LOC_BLOCK; |
/* Now we copy all the symbols which have been defined since the BCOMM. */ |
@@ -4731,12 +4727,12 @@ scan_file_globals (struct objfile *objfile) |
/* 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 " |
"global_sym_chain unresolved"), |
- objfile->name, SYMBOL_PRINT_NAME (prev)); |
+ objfile_name (objfile), SYMBOL_PRINT_NAME (prev)); |
} |
} |
memset (global_sym_chain, 0, sizeof (global_sym_chain)); |
@@ -4846,4 +4842,9 @@ _initialize_stabsread (void) |
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); |
} |