2004-02-07 Elena Zannoni <ezannoni@redhat.com>

* objfiles.h (struct objfile): Add objfile_obstack field.
        Remove type_obstack field.

        * dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
        read_structure_scope read_enumeration, new_symbol): Replace
        type_obstack with objfile_obstack.
        * dwarfread.c (struct_type, enum_type): Ditto.
        * gdbtypes.c (alloc_type, alloc_type_instance, init_type)
        (lookup_fundamental_type): Ditto.
        * gdbtypes.h (TYPE_ALLOC): Ditto.
        * hpread.c (hpread_read_enum_type, hpread_read_function_type)
        (hpread_read_doc_function_type, hpread_read_struct_type)
        (fix_static_member_physnames, hpread_read_array_type)
        (hpread_read_subrange_type, hpread_type_lookup): Ditto.
        * jv-lang.c (java_lookup_class, type_from_class, type_from_class)
        (java_link_class_type): Ditto.
        * mdebugread.c (parse_type): Ditto.
        * objfiles.c (allocate_objfile, free_objfile): Ditto.
        * solib-sunos.c (solib_add_common_symbols): Ditto.
        * stabsread.c (define_symbol, read_type, read_member_functions,
        read_cpp_abbrev, read_one_struct_field): Ditto.
        * symfile.c (reread_symbols): Ditto.
        * symmisc.c (print_objfile_statistics): Ditto.
This commit is contained in:
Elena Zannoni 2004-02-07 16:57:55 +00:00
parent 2a8854a783
commit b99607ea3c
14 changed files with 110 additions and 74 deletions

View file

@ -1,3 +1,29 @@
2004-02-07 Elena Zannoni <ezannoni@redhat.com>
* objfiles.h (struct objfile): Add objfile_obstack field.
Remove type_obstack field.
* dwarf2read.c (dwarf2_add_field,dwarf2_add_member_fn,
read_structure_scope read_enumeration, new_symbol): Replace
type_obstack with objfile_obstack.
* dwarfread.c (struct_type, enum_type): Ditto.
* gdbtypes.c (alloc_type, alloc_type_instance, init_type)
(lookup_fundamental_type): Ditto.
* gdbtypes.h (TYPE_ALLOC): Ditto.
* hpread.c (hpread_read_enum_type, hpread_read_function_type)
(hpread_read_doc_function_type, hpread_read_struct_type)
(fix_static_member_physnames, hpread_read_array_type)
(hpread_read_subrange_type, hpread_type_lookup): Ditto.
* jv-lang.c (java_lookup_class, type_from_class, type_from_class)
(java_link_class_type): Ditto.
* mdebugread.c (parse_type): Ditto.
* objfiles.c (allocate_objfile, free_objfile): Ditto.
* solib-sunos.c (solib_add_common_symbols): Ditto.
* stabsread.c (define_symbol, read_type, read_member_functions,
read_cpp_abbrev, read_one_struct_field): Ditto.
* symfile.c (reread_symbols): Ditto.
* symmisc.c (print_objfile_statistics): Ditto.
2004-02-07 Andrew Cagney <cagney@redhat.com> 2004-02-07 Andrew Cagney <cagney@redhat.com>
* tui/tui-data.h (tui_win_element): Rename TuiWinElement. * tui/tui-data.h (tui_win_element): Rename TuiWinElement.

View file

@ -2666,7 +2666,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
if (attr && DW_STRING (attr)) if (attr && DW_STRING (attr))
fieldname = DW_STRING (attr); fieldname = DW_STRING (attr);
fp->name = obsavestring (fieldname, strlen (fieldname), fp->name = obsavestring (fieldname, strlen (fieldname),
&objfile->type_obstack); &objfile->objfile_obstack);
/* Change accessibility for artificial fields (e.g. virtual table /* Change accessibility for artificial fields (e.g. virtual table
pointer or virtual base class pointer) to private. */ pointer or virtual base class pointer) to private. */
@ -2698,10 +2698,10 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die,
physname = dwarf2_linkage_name (die, cu); physname = dwarf2_linkage_name (die, cu);
SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname), SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname),
&objfile->type_obstack)); &objfile->objfile_obstack));
FIELD_TYPE (*fp) = die_type (die, cu); FIELD_TYPE (*fp) = die_type (die, cu);
FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname), FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname),
&objfile->type_obstack); &objfile->objfile_obstack);
} }
else if (die->tag == DW_TAG_inheritance) else if (die->tag == DW_TAG_inheritance)
{ {
@ -2870,7 +2870,7 @@ dwarf2_add_member_fn (struct field_info *fip, struct die_info *die,
/* Fill in the member function field info. */ /* Fill in the member function field info. */
fnp = &new_fnfield->fnfield; fnp = &new_fnfield->fnfield;
fnp->physname = obsavestring (physname, strlen (physname), fnp->physname = obsavestring (physname, strlen (physname),
&objfile->type_obstack); &objfile->objfile_obstack);
fnp->type = alloc_type (objfile); fnp->type = alloc_type (objfile);
if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC) if (die->type && TYPE_CODE (die->type) == TYPE_CODE_FUNC)
{ {
@ -3036,7 +3036,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
TYPE_TAG_NAME to be a const char *, I ran into a cascade TYPE_TAG_NAME to be a const char *, I ran into a cascade
of changes which would have forced decode_line_1 to take of changes which would have forced decode_line_1 to take
a const char **. */ a const char **. */
char *new_prefix = obconcat (&objfile->type_obstack, char *new_prefix = obconcat (&objfile->objfile_obstack,
processing_current_prefix, processing_current_prefix,
processing_current_prefix[0] == '\0' processing_current_prefix[0] == '\0'
? "" : "::", ? "" : "::",
@ -3047,7 +3047,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
else else
{ {
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), TYPE_TAG_NAME (type) = obsavestring (name, strlen (name),
&objfile->type_obstack); &objfile->objfile_obstack);
need_to_update_name = (cu->language == language_cplus); need_to_update_name = (cu->language == language_cplus);
} }
} }
@ -3139,7 +3139,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
TYPE_TAG_NAME (type) TYPE_TAG_NAME (type)
= obsavestring (actual_class_name, = obsavestring (actual_class_name,
strlen (actual_class_name), strlen (actual_class_name),
&objfile->type_obstack); &objfile->objfile_obstack);
} }
xfree (actual_class_name); xfree (actual_class_name);
need_to_update_name = 0; need_to_update_name = 0;
@ -3256,7 +3256,7 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu)
if (processing_has_namespace_info) if (processing_has_namespace_info)
{ {
TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
processing_current_prefix, processing_current_prefix,
processing_current_prefix[0] == '\0' processing_current_prefix[0] == '\0'
? "" : "::", ? "" : "::",
@ -3265,7 +3265,7 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu)
else else
{ {
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), TYPE_TAG_NAME (type) = obsavestring (name, strlen (name),
&objfile->type_obstack); &objfile->objfile_obstack);
} }
} }
@ -5717,7 +5717,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
TYPE_NAME (SYMBOL_TYPE (sym)) = TYPE_NAME (SYMBOL_TYPE (sym)) =
obsavestring (SYMBOL_NATURAL_NAME (sym), obsavestring (SYMBOL_NATURAL_NAME (sym),
strlen (SYMBOL_NATURAL_NAME (sym)), strlen (SYMBOL_NATURAL_NAME (sym)),
&objfile->type_obstack); &objfile->objfile_obstack);
add_symbol_to_list (typedef_sym, list_to_add); add_symbol_to_list (typedef_sym, list_to_add);
} }
} }

View file

@ -1,7 +1,7 @@
/* DWARF debugging format support for GDB. /* DWARF debugging format support for GDB.
Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2000, 2001, 2002, 2003 Free Software Foundation, Inc. 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Written by Fred Fish at Cygnus Support. Portions based on dbxread.c, Written by Fred Fish at Cygnus Support. Portions based on dbxread.c,
mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port. mipsread.c, coffread.c, and dwarfread.c from a Data General SVR4 gdb port.
@ -968,7 +968,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
&& *dip->at_name != '~' && *dip->at_name != '~'
&& *dip->at_name != '.') && *dip->at_name != '.')
{ {
TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
"", "", dip->at_name); "", "", dip->at_name);
} }
/* Use whatever size is known. Zero is a valid size. We might however /* Use whatever size is known. Zero is a valid size. We might however
@ -1011,7 +1011,7 @@ struct_type (struct dieinfo *dip, char *thisdie, char *enddie,
/* Save the data. */ /* Save the data. */
list->field.name = list->field.name =
obsavestring (mbr.at_name, strlen (mbr.at_name), obsavestring (mbr.at_name, strlen (mbr.at_name),
&objfile->type_obstack); &objfile->objfile_obstack);
FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_TYPE (list->field) = decode_die_type (&mbr);
FIELD_BITPOS (list->field) = 8 * locval (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr);
FIELD_STATIC_KIND (list->field) = 0; FIELD_STATIC_KIND (list->field) = 0;
@ -1670,7 +1670,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
&& *dip->at_name != '~' && *dip->at_name != '~'
&& *dip->at_name != '.') && *dip->at_name != '.')
{ {
TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack,
"", "", dip->at_name); "", "", dip->at_name);
} }
if (dip->at_byte_size != 0) if (dip->at_byte_size != 0)
@ -1704,7 +1704,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile)
objfile); objfile);
scan += TARGET_FT_LONG_SIZE (objfile); scan += TARGET_FT_LONG_SIZE (objfile);
list->field.name = obsavestring (scan, strlen (scan), list->field.name = obsavestring (scan, strlen (scan),
&objfile->type_obstack); &objfile->objfile_obstack);
scan += strlen (scan) + 1; scan += strlen (scan) + 1;
nfields++; nfields++;
/* Handcraft a new symbol for this enum member. */ /* Handcraft a new symbol for this enum member. */

View file

@ -1,6 +1,6 @@
/* Support routines for manipulating internal types for GDB. /* Support routines for manipulating internal types for GDB.
Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003,
Free Software Foundation, Inc. 2004 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB. This file is part of GDB.
@ -136,7 +136,7 @@ static void virtual_base_list_aux (struct type *dclass);
/* Alloc a new type structure and fill it with some defaults. If /* Alloc a new type structure and fill it with some defaults. If
OBJFILE is non-NULL, then allocate the space for the type structure OBJFILE is non-NULL, then allocate the space for the type structure
in that objfile's type_obstack. Otherwise allocate the new type structure in that objfile's objfile_obstack. Otherwise allocate the new type structure
by xmalloc () (for permanent types). */ by xmalloc () (for permanent types). */
struct type * struct type *
@ -154,10 +154,10 @@ alloc_type (struct objfile *objfile)
} }
else else
{ {
type = obstack_alloc (&objfile->type_obstack, type = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct type)); sizeof (struct type));
memset (type, 0, sizeof (struct type)); memset (type, 0, sizeof (struct type));
TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->type_obstack, TYPE_MAIN_TYPE (type) = obstack_alloc (&objfile->objfile_obstack,
sizeof (struct main_type)); sizeof (struct main_type));
OBJSTAT (objfile, n_types++); OBJSTAT (objfile, n_types++);
} }
@ -191,7 +191,7 @@ alloc_type_instance (struct type *oldtype)
} }
else else
{ {
type = obstack_alloc (&TYPE_OBJFILE (oldtype)->type_obstack, type = obstack_alloc (&TYPE_OBJFILE (oldtype)->objfile_obstack,
sizeof (struct type)); sizeof (struct type));
memset (type, 0, sizeof (struct type)); memset (type, 0, sizeof (struct type));
} }
@ -1675,7 +1675,7 @@ allocate_cplus_struct_type (struct type *type)
/* Helper function to initialize the standard scalar types. /* Helper function to initialize the standard scalar types.
If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy If NAME is non-NULL and OBJFILE is non-NULL, then we make a copy
of the string pointed to by name in the type_obstack for that objfile, of the string pointed to by name in the objfile_obstack for that objfile,
and initialize the type name to that copy. There are places (mipsread.c and initialize the type name to that copy. There are places (mipsread.c
in particular, where init_type is called with a NULL value for NAME). */ in particular, where init_type is called with a NULL value for NAME). */
@ -1692,7 +1692,7 @@ init_type (enum type_code code, int length, int flags, char *name,
if ((name != NULL) && (objfile != NULL)) if ((name != NULL) && (objfile != NULL))
{ {
TYPE_NAME (type) = TYPE_NAME (type) =
obsavestring (name, strlen (name), &objfile->type_obstack); obsavestring (name, strlen (name), &objfile->objfile_obstack);
} }
else else
{ {
@ -1793,7 +1793,7 @@ lookup_fundamental_type (struct objfile *objfile, int typeid)
{ {
nbytes = FT_NUM_MEMBERS * sizeof (struct type *); nbytes = FT_NUM_MEMBERS * sizeof (struct type *);
objfile->fundamental_types = (struct type **) objfile->fundamental_types = (struct type **)
obstack_alloc (&objfile->type_obstack, nbytes); obstack_alloc (&objfile->objfile_obstack, nbytes);
memset ((char *) objfile->fundamental_types, 0, nbytes); memset ((char *) objfile->fundamental_types, 0, nbytes);
OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); OBJSTAT (objfile, n_types += FT_NUM_MEMBERS);
} }

View file

@ -1,7 +1,7 @@
/* Internal type definitions for GDB. /* Internal type definitions for GDB.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003 Free Software Foundation, Inc. 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
@ -320,7 +320,7 @@ struct main_type
char *tag_name; char *tag_name;
/* Every type is now associated with a particular objfile, and the /* Every type is now associated with a particular objfile, and the
type is allocated on the type_obstack for that objfile. One problem type is allocated on the objfile_obstack for that objfile. One problem
however, is that there are times when gdb allocates new types while however, is that there are times when gdb allocates new types while
it is not in the process of reading symbols from a particular objfile. it is not in the process of reading symbols from a particular objfile.
Fortunately, these happen when the type being created is a derived Fortunately, these happen when the type being created is a derived
@ -1069,15 +1069,15 @@ extern struct type *builtin_type_f_void;
/* Allocate space for storing data associated with a particular type. /* Allocate space for storing data associated with a particular type.
We ensure that the space is allocated using the same mechanism that We ensure that the space is allocated using the same mechanism that
was used to allocate the space for the type structure itself. I.E. was used to allocate the space for the type structure itself. I.E.
if the type is on an objfile's type_obstack, then the space for data if the type is on an objfile's objfile_obstack, then the space for data
associated with that type will also be allocated on the type_obstack. associated with that type will also be allocated on the objfile_obstack.
If the type is not associated with any particular objfile (such as If the type is not associated with any particular objfile (such as
builtin types), then the data space will be allocated with xmalloc, builtin types), then the data space will be allocated with xmalloc,
the same as for the type structure. */ the same as for the type structure. */
#define TYPE_ALLOC(t,size) \ #define TYPE_ALLOC(t,size) \
(TYPE_OBJFILE (t) != NULL \ (TYPE_OBJFILE (t) != NULL \
? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \ ? obstack_alloc (&TYPE_OBJFILE (t) -> objfile_obstack, size) \
: xmalloc (size)) : xmalloc (size))
extern struct type *alloc_type (struct objfile *); extern struct type *alloc_type (struct objfile *);

View file

@ -3145,7 +3145,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB;
TYPE_NFIELDS (type) = nsyms; TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *) TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nsyms); obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms);
/* Find the symbols for the members and put them into the type. /* Find the symbols for the members and put them into the type.
The symbols can be found in the symlist that we put them on The symbols can be found in the symlist that we put them on
@ -3306,7 +3306,7 @@ hpread_read_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
/* Note how many parameters we found. */ /* Note how many parameters we found. */
TYPE_NFIELDS (type) = nsyms; TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *) TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack, obstack_alloc (&objfile->objfile_obstack,
sizeof (struct field) * nsyms); sizeof (struct field) * nsyms);
/* Find the symbols for the parameters and /* Find the symbols for the parameters and
@ -3485,7 +3485,7 @@ hpread_read_doc_function_type (dnttpointer hp_type, union dnttentry *dn_bufp,
/* Note how many parameters we found. */ /* Note how many parameters we found. */
TYPE_NFIELDS (type) = nsyms; TYPE_NFIELDS (type) = nsyms;
TYPE_FIELDS (type) = (struct field *) TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack, obstack_alloc (&objfile->objfile_obstack,
sizeof (struct field) * nsyms); sizeof (struct field) * nsyms);
/* Find the symbols for the parameters and /* Find the symbols for the parameters and
@ -3782,7 +3782,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
if (n_templ_args > 0) if (n_templ_args > 0)
TYPE_TEMPLATE_ARGS (type) = (struct template_arg *) TYPE_TEMPLATE_ARGS (type) = (struct template_arg *)
obstack_alloc (&objfile->type_obstack, sizeof (struct template_arg) * n_templ_args); obstack_alloc (&objfile->objfile_obstack, sizeof (struct template_arg) * n_templ_args);
for (n = n_templ_args; t_list; t_list = t_list->next) for (n = n_templ_args; t_list; t_list = t_list->next)
{ {
n -= 1; n -= 1;
@ -4255,7 +4255,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_NINSTANTIATIONS (type) = ninstantiations; TYPE_NINSTANTIATIONS (type) = ninstantiations;
if (ninstantiations > 0) if (ninstantiations > 0)
TYPE_INSTANTIATIONS (type) = (struct type **) TYPE_INSTANTIATIONS (type) = (struct type **)
obstack_alloc (&objfile->type_obstack, sizeof (struct type *) * ninstantiations); obstack_alloc (&objfile->objfile_obstack, sizeof (struct type *) * ninstantiations);
for (n = ninstantiations; i_list; i_list = i_list->next) for (n = ninstantiations; i_list; i_list = i_list->next)
{ {
n -= 1; n -= 1;
@ -4267,7 +4267,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_NFIELDS (type) = nfields; TYPE_NFIELDS (type) = nfields;
TYPE_N_BASECLASSES (type) = n_base_classes; TYPE_N_BASECLASSES (type) = n_base_classes;
TYPE_FIELDS (type) = (struct field *) TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack, sizeof (struct field) * nfields); obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nfields);
/* Copy the saved-up fields into the field vector. */ /* Copy the saved-up fields into the field vector. */
for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next) for (n = nfields, tmp_list = list; tmp_list; tmp_list = tmp_list->next)
{ {
@ -4281,7 +4281,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_NFN_FIELDS (type) = n_fn_fields; TYPE_NFN_FIELDS (type) = n_fn_fields;
TYPE_NFN_FIELDS_TOTAL (type) = n_fn_fields_total; TYPE_NFN_FIELDS_TOTAL (type) = n_fn_fields_total;
TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *) TYPE_FN_FIELDLISTS (type) = (struct fn_fieldlist *)
obstack_alloc (&objfile->type_obstack, sizeof (struct fn_fieldlist) * n_fn_fields); obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_fieldlist) * n_fn_fields);
for (n = n_fn_fields; fn_list; fn_list = fn_list->next) for (n = n_fn_fields; fn_list; fn_list = fn_list->next)
{ {
n -= 1; n -= 1;
@ -4399,7 +4399,7 @@ fix_static_member_physnames (struct type *type, char *class_name,
return; /* physnames are already set */ return; /* physnames are already set */
SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i], SET_FIELD_PHYSNAME (TYPE_FIELDS (type)[i],
obstack_alloc (&objfile->type_obstack, obstack_alloc (&objfile->objfile_obstack,
strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3)); strlen (class_name) + strlen (TYPE_FIELD_NAME (type, i)) + 3));
strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name); strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name);
strcat (TYPE_FIELD_STATIC_PHYSNAME (type, i), "::"); strcat (TYPE_FIELD_STATIC_PHYSNAME (type, i), "::");
@ -4562,7 +4562,7 @@ hpread_read_array_type (dnttpointer hp_type, union dnttentry *dn_bufp,
*/ */
TYPE_NFIELDS (type) = 1; TYPE_NFIELDS (type) = 1;
TYPE_FIELDS (type) = (struct field *) TYPE_FIELDS (type) = (struct field *)
obstack_alloc (&objfile->type_obstack, sizeof (struct field)); obstack_alloc (&objfile->objfile_obstack, sizeof (struct field));
TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype, TYPE_FIELD_TYPE (type, 0) = hpread_type_lookup (dn_bufp->darray.indextype,
objfile); objfile);
return type; return type;
@ -4585,7 +4585,7 @@ hpread_read_subrange_type (dnttpointer hp_type, union dnttentry *dn_bufp,
TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8; TYPE_LENGTH (type) = dn_bufp->dsubr.bitlength / 8;
TYPE_NFIELDS (type) = 2; TYPE_NFIELDS (type) = 2;
TYPE_FIELDS (type) TYPE_FIELDS (type)
= (struct field *) obstack_alloc (&objfile->type_obstack, = (struct field *) obstack_alloc (&objfile->objfile_obstack,
2 * sizeof (struct field)); 2 * sizeof (struct field));
if (dn_bufp->dsubr.dyn_low) if (dn_bufp->dsubr.dyn_low)
@ -4803,7 +4803,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile)
/* Build the correct name. */ /* Build the correct name. */
TYPE_NAME (structtype) TYPE_NAME (structtype)
= (char *) obstack_alloc (&objfile->type_obstack, = (char *) obstack_alloc (&objfile->objfile_obstack,
strlen (prefix) + strlen (suffix) + 1); strlen (prefix) + strlen (suffix) + 1);
TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix); TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix);
TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix); TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix);

View file

@ -186,7 +186,7 @@ java_lookup_class (char *name)
type = alloc_type (objfile); type = alloc_type (objfile);
TYPE_CODE (type) = TYPE_CODE_STRUCT; TYPE_CODE (type) = TYPE_CODE_STRUCT;
INIT_CPLUS_SPECIFIC (type); INIT_CPLUS_SPECIFIC (type);
TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->type_obstack); TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), &objfile->objfile_obstack);
TYPE_FLAGS (type) |= TYPE_FLAG_STUB; TYPE_FLAGS (type) |= TYPE_FLAG_STUB;
TYPE ? = addr; TYPE ? = addr;
return type; return type;
@ -289,7 +289,7 @@ type_from_class (struct value *clas)
/* if clasloader non-null, prepend loader address. FIXME */ /* if clasloader non-null, prepend loader address. FIXME */
temp = clas; temp = clas;
utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure"); utf8_name = value_struct_elt (&temp, NULL, "name", NULL, "structure");
name = get_java_utf8_name (&objfile->type_obstack, utf8_name); name = get_java_utf8_name (&objfile->objfile_obstack, utf8_name);
for (nptr = name; *nptr != 0; nptr++) for (nptr = name; *nptr != 0; nptr++)
{ {
if (*nptr == '/') if (*nptr == '/')
@ -309,7 +309,7 @@ type_from_class (struct value *clas)
char *signature = name; char *signature = name;
int namelen = java_demangled_signature_length (signature); int namelen = java_demangled_signature_length (signature);
if (namelen > strlen (name)) if (namelen > strlen (name))
name = obstack_alloc (&objfile->type_obstack, namelen + 1); name = obstack_alloc (&objfile->objfile_obstack, namelen + 1);
java_demangled_signature_copy (name, signature); java_demangled_signature_copy (name, signature);
name[namelen] = '\0'; name[namelen] = '\0';
is_array = 1; is_array = 1;
@ -442,7 +442,7 @@ java_link_class_type (struct type *type, struct value *clas)
temp = field; temp = field;
temp = value_struct_elt (&temp, NULL, "name", NULL, "structure"); temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
TYPE_FIELD_NAME (type, i) = TYPE_FIELD_NAME (type, i) =
get_java_utf8_name (&objfile->type_obstack, temp); get_java_utf8_name (&objfile->objfile_obstack, temp);
temp = field; temp = field;
accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags", accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags",
NULL, "structure")); NULL, "structure"));
@ -513,7 +513,7 @@ java_link_class_type (struct type *type, struct value *clas)
/* Get method name. */ /* Get method name. */
temp = method; temp = method;
temp = value_struct_elt (&temp, NULL, "name", NULL, "structure"); temp = value_struct_elt (&temp, NULL, "name", NULL, "structure");
mname = get_java_utf8_name (&objfile->type_obstack, temp); mname = get_java_utf8_name (&objfile->objfile_obstack, temp);
if (strcmp (mname, "<init>") == 0) if (strcmp (mname, "<init>") == 0)
mname = unqualified_name; mname = unqualified_name;
@ -538,7 +538,7 @@ java_link_class_type (struct type *type, struct value *clas)
{ /* Found an existing method with the same name. */ { /* Found an existing method with the same name. */
int l; int l;
if (mname != unqualified_name) if (mname != unqualified_name)
obstack_free (&objfile->type_obstack, mname); obstack_free (&objfile->objfile_obstack, mname);
mname = fn_fieldlists[j].name; mname = fn_fieldlists[j].name;
fn_fieldlists[j].length++; fn_fieldlists[j].length++;
k = i - k; /* Index of new slot. */ k = i - k; /* Index of new slot. */

View file

@ -1637,7 +1637,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
else if (TYPE_TAG_NAME (tp) == NULL else if (TYPE_TAG_NAME (tp) == NULL
|| strcmp (TYPE_TAG_NAME (tp), name) != 0) || strcmp (TYPE_TAG_NAME (tp), name) != 0)
TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name), TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name),
&current_objfile->type_obstack); &current_objfile->objfile_obstack);
} }
} }
@ -1673,7 +1673,7 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
if (TYPE_NAME (tp) == NULL if (TYPE_NAME (tp) == NULL
|| strcmp (TYPE_NAME (tp), name) != 0) || strcmp (TYPE_NAME (tp), name) != 0)
TYPE_NAME (tp) = obsavestring (name, strlen (name), TYPE_NAME (tp) = obsavestring (name, strlen (name),
&current_objfile->type_obstack); &current_objfile->objfile_obstack);
} }
} }
if (t->bt == btTypedef) if (t->bt == btTypedef)
@ -1697,11 +1697,11 @@ parse_type (int fd, union aux_ext *ax, unsigned int aux_index, int *bs,
TYPE_FIELDS (tp) = ((struct field *) TYPE_FIELDS (tp) = ((struct field *)
TYPE_ALLOC (tp, 2 * sizeof (struct field))); TYPE_ALLOC (tp, 2 * sizeof (struct field)));
TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"), TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"),
&current_objfile->type_obstack); &current_objfile->objfile_obstack);
TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax); TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax);
ax++; ax++;
TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"), TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"),
&current_objfile->type_obstack); &current_objfile->objfile_obstack);
TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax); TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax);
ax++; ax++;
} }

View file

@ -1,7 +1,7 @@
/* GDB routines for manipulating objfiles. /* GDB routines for manipulating objfiles.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003 Free Software Foundation, Inc. 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
@ -169,7 +169,7 @@ allocate_objfile (bfd *abfd, int flags)
xfree); xfree);
obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
xfree); xfree);
obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc,
xfree); xfree);
terminate_minimal_symbol_table (objfile); terminate_minimal_symbol_table (objfile);
@ -433,7 +433,7 @@ free_objfile (struct objfile *objfile)
htab_delete (objfile->demangled_names_hash); htab_delete (objfile->demangled_names_hash);
obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->psymbol_obstack, 0);
obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0);
obstack_free (&objfile->type_obstack, 0); obstack_free (&objfile->objfile_obstack, 0);
xmfree (objfile->md, objfile); xmfree (objfile->md, objfile);
objfile = NULL; objfile = NULL;
} }

View file

@ -1,7 +1,7 @@
/* Definitions for symbol file management in GDB. /* Definitions for symbol file management in GDB.
Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
2001, 2002, 2003 Free Software Foundation, Inc. 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -281,12 +281,22 @@ struct objfile
long mtime; long mtime;
/* Obstack to hold objects that should be freed when we load a new symbol
table from this object file. */
/* Note ezannoni 2004-02-05: this obstack will become the only
obstack per objfile instead of having 3 separate ones with the
same lifetime. I am in the process of gradually migrating the
old obstacks to this one, so that it can be used more
freely. */
struct obstack objfile_obstack;
/* Obstacks to hold objects that should be freed when we load a new symbol /* Obstacks to hold objects that should be freed when we load a new symbol
table from this object file. */ table from this object file. */
struct obstack psymbol_obstack; /* Partial symbols */ struct obstack psymbol_obstack; /* Partial symbols */
struct obstack symbol_obstack; /* Full symbols */ struct obstack symbol_obstack; /* Full symbols */
struct obstack type_obstack; /* Types */
/* A byte cache where we can stash arbitrary "chunks" of bytes that /* A byte cache where we can stash arbitrary "chunks" of bytes that
will not change. */ will not change. */
@ -509,7 +519,7 @@ extern struct objfile *symfile_objfile;
extern struct objfile *rt_common_objfile; extern struct objfile *rt_common_objfile;
/* When we need to allocate a new type, we need to know which type_obstack /* When we need to allocate a new type, we need to know which objfile_obstack
to allocate the type on, since there is one for each objfile. The places to allocate the type on, since there is one for each objfile. The places
where types are allocated are deeply buried in function call hierarchies where types are allocated are deeply buried in function call hierarchies
which know nothing about objfiles, so rather than trying to pass a which know nothing about objfiles, so rather than trying to pass a

View file

@ -1,6 +1,6 @@
/* Handle SunOS shared libraries for GDB, the GNU Debugger. /* Handle SunOS shared libraries for GDB, the GNU Debugger.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
2001 2001, 2004
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -149,7 +149,7 @@ allocate_rt_common_objfile (void)
xfree); xfree);
obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc,
xfree); xfree);
obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc,
xfree); xfree);
objfile->name = mstrsave (objfile->md, "rt_common"); objfile->name = mstrsave (objfile->md, "rt_common");

View file

@ -1251,7 +1251,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN;
if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0)
TYPE_TAG_NAME (SYMBOL_TYPE (sym)) TYPE_TAG_NAME (SYMBOL_TYPE (sym))
= obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym));
add_symbol_to_list (sym, &file_symbols); add_symbol_to_list (sym, &file_symbols);
if (synonym) if (synonym)
@ -1265,7 +1265,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type,
SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN;
if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0)
TYPE_NAME (SYMBOL_TYPE (sym)) TYPE_NAME (SYMBOL_TYPE (sym))
= obconcat (&objfile->type_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym)); = obconcat (&objfile->objfile_obstack, "", "", DEPRECATED_SYMBOL_NAME (sym));
add_symbol_to_list (typedef_sym, &file_symbols); add_symbol_to_list (typedef_sym, &file_symbols);
} }
break; break;
@ -1527,7 +1527,7 @@ again:
return error_type (pp, objfile); return error_type (pp, objfile);
} }
to = type_name = to = type_name =
(char *) obstack_alloc (&objfile->type_obstack, p - *pp + 1); (char *) obstack_alloc (&objfile->objfile_obstack, p - *pp + 1);
/* Copy the name. */ /* Copy the name. */
from = *pp + 1; from = *pp + 1;
@ -1554,7 +1554,7 @@ again:
&& (TYPE_CODE (SYMBOL_TYPE (sym)) == code) && (TYPE_CODE (SYMBOL_TYPE (sym)) == code)
&& strcmp (DEPRECATED_SYMBOL_NAME (sym), type_name) == 0) && strcmp (DEPRECATED_SYMBOL_NAME (sym), type_name) == 0)
{ {
obstack_free (&objfile->type_obstack, type_name); obstack_free (&objfile->objfile_obstack, type_name);
type = SYMBOL_TYPE (sym); type = SYMBOL_TYPE (sym);
if (typenums[0] != -1) if (typenums[0] != -1)
*dbx_lookup_type (typenums) = type; *dbx_lookup_type (typenums) = type;
@ -2511,11 +2511,11 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
make_cleanup (xfree, destr_fnlist); make_cleanup (xfree, destr_fnlist);
memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist)); memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist));
destr_fnlist->fn_fieldlist.name destr_fnlist->fn_fieldlist.name
= obconcat (&objfile->type_obstack, "", "~", = obconcat (&objfile->objfile_obstack, "", "~",
new_fnlist->fn_fieldlist.name); new_fnlist->fn_fieldlist.name);
destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) destr_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
obstack_alloc (&objfile->type_obstack, obstack_alloc (&objfile->objfile_obstack,
sizeof (struct fn_field) * has_destructor); sizeof (struct fn_field) * has_destructor);
memset (destr_fnlist->fn_fieldlist.fn_fields, 0, memset (destr_fnlist->fn_fieldlist.fn_fields, 0,
sizeof (struct fn_field) * has_destructor); sizeof (struct fn_field) * has_destructor);
@ -2576,11 +2576,11 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type,
if (ret) if (ret)
new_fnlist->fn_fieldlist.name new_fnlist->fn_fieldlist.name
= obsavestring (dem_opname, strlen (dem_opname), = obsavestring (dem_opname, strlen (dem_opname),
&objfile->type_obstack); &objfile->objfile_obstack);
} }
new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *)
obstack_alloc (&objfile->type_obstack, obstack_alloc (&objfile->objfile_obstack,
sizeof (struct fn_field) * length); sizeof (struct fn_field) * length);
memset (new_fnlist->fn_fieldlist.fn_fields, 0, memset (new_fnlist->fn_fieldlist.fn_fields, 0,
sizeof (struct fn_field) * length); sizeof (struct fn_field) * length);
@ -2649,7 +2649,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
name = ""; name = "";
} }
fip->list->field.name = fip->list->field.name =
obconcat (&objfile->type_obstack, vptr_name, name, ""); obconcat (&objfile->objfile_obstack, vptr_name, name, "");
break; break;
case 'b': /* $vb -- a virtual bsomethingorother */ case 'b': /* $vb -- a virtual bsomethingorother */
@ -2662,13 +2662,13 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type,
name = "FOO"; name = "FOO";
} }
fip->list->field.name = fip->list->field.name =
obconcat (&objfile->type_obstack, vb_name, name, ""); obconcat (&objfile->objfile_obstack, vb_name, name, "");
break; break;
default: default:
invalid_cpp_abbrev_complaint (*pp); invalid_cpp_abbrev_complaint (*pp);
fip->list->field.name = fip->list->field.name =
obconcat (&objfile->type_obstack, obconcat (&objfile->objfile_obstack,
"INVALID_CPLUSPLUS_ABBREV", "", ""); "INVALID_CPLUSPLUS_ABBREV", "", "");
break; break;
} }
@ -2714,7 +2714,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p,
struct type *type, struct objfile *objfile) struct type *type, struct objfile *objfile)
{ {
fip->list->field.name = fip->list->field.name =
obsavestring (*pp, p - *pp, &objfile->type_obstack); obsavestring (*pp, p - *pp, &objfile->objfile_obstack);
*pp = p + 1; *pp = p + 1;
/* This means we have a visibility for a field coming. */ /* This means we have a visibility for a field coming. */

View file

@ -1913,7 +1913,7 @@ reread_symbols (void)
} }
obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->psymbol_obstack, 0);
obstack_free (&objfile->symbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0);
obstack_free (&objfile->type_obstack, 0); obstack_free (&objfile->objfile_obstack, 0);
objfile->sections = NULL; objfile->sections = NULL;
objfile->symtabs = NULL; objfile->symtabs = NULL;
objfile->psymtabs = NULL; objfile->psymtabs = NULL;
@ -1943,7 +1943,7 @@ reread_symbols (void)
xmalloc, xfree); xmalloc, xfree);
obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, obstack_specify_allocation (&objfile->symbol_obstack, 0, 0,
xmalloc, xfree); xmalloc, xfree);
obstack_specify_allocation (&objfile->type_obstack, 0, 0, obstack_specify_allocation (&objfile->objfile_obstack, 0, 0,
xmalloc, xfree); xmalloc, xfree);
if (build_objfile_section_table (objfile)) if (build_objfile_section_table (objfile))
{ {

View file

@ -1,7 +1,7 @@
/* Do various things to symbol tables (other than lookup), for GDB. /* Do various things to symbol tables (other than lookup), for GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003 Free Software 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004 Free Software
Foundation, Inc. Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -239,7 +239,7 @@ print_objfile_statistics (void)
printf_filtered (" Total memory used for symbol obstack: %d\n", printf_filtered (" Total memory used for symbol obstack: %d\n",
obstack_memory_used (&objfile->symbol_obstack)); obstack_memory_used (&objfile->symbol_obstack));
printf_filtered (" Total memory used for type obstack: %d\n", printf_filtered (" Total memory used for type obstack: %d\n",
obstack_memory_used (&objfile->type_obstack)); obstack_memory_used (&objfile->objfile_obstack));
} }
immediate_quit--; immediate_quit--;
} }