From b99607ea3cc204c613ef8acf0fce8bdffb7e89e7 Mon Sep 17 00:00:00 2001 From: Elena Zannoni Date: Sat, 7 Feb 2004 16:57:55 +0000 Subject: 2004-02-07 Elena Zannoni * 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. --- gdb/ChangeLog | 26 ++++++++++++++++++++++++++ gdb/dwarf2read.c | 20 ++++++++++---------- gdb/dwarfread.c | 10 +++++----- gdb/gdbtypes.c | 18 +++++++++--------- gdb/gdbtypes.h | 10 +++++----- gdb/hpread.c | 22 +++++++++++----------- gdb/jv-lang.c | 12 ++++++------ gdb/mdebugread.c | 8 ++++---- gdb/objfiles.c | 6 +++--- gdb/objfiles.h | 16 +++++++++++++--- gdb/solib-sunos.c | 4 ++-- gdb/stabsread.c | 24 ++++++++++++------------ gdb/symfile.c | 4 ++-- gdb/symmisc.c | 4 ++-- 14 files changed, 110 insertions(+), 74 deletions(-) (limited to 'gdb') diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a3122e0..f1a24b3 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,29 @@ +2004-02-07 Elena Zannoni + + * 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 * tui/tui-data.h (tui_win_element): Rename TuiWinElement. diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 9fe77d3..3c93215 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -2666,7 +2666,7 @@ dwarf2_add_field (struct field_info *fip, struct die_info *die, if (attr && DW_STRING (attr)) fieldname = DW_STRING (attr); fp->name = obsavestring (fieldname, strlen (fieldname), - &objfile->type_obstack); + &objfile->objfile_obstack); /* Change accessibility for artificial fields (e.g. virtual table 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); SET_FIELD_PHYSNAME (*fp, obsavestring (physname, strlen (physname), - &objfile->type_obstack)); + &objfile->objfile_obstack)); FIELD_TYPE (*fp) = die_type (die, cu); FIELD_NAME (*fp) = obsavestring (fieldname, strlen (fieldname), - &objfile->type_obstack); + &objfile->objfile_obstack); } 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. */ fnp = &new_fnfield->fnfield; fnp->physname = obsavestring (physname, strlen (physname), - &objfile->type_obstack); + &objfile->objfile_obstack); fnp->type = alloc_type (objfile); 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 of changes which would have forced decode_line_1 to take a const char **. */ - char *new_prefix = obconcat (&objfile->type_obstack, + char *new_prefix = obconcat (&objfile->objfile_obstack, processing_current_prefix, processing_current_prefix[0] == '\0' ? "" : "::", @@ -3047,7 +3047,7 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu) else { TYPE_TAG_NAME (type) = obsavestring (name, strlen (name), - &objfile->type_obstack); + &objfile->objfile_obstack); 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) = obsavestring (actual_class_name, strlen (actual_class_name), - &objfile->type_obstack); + &objfile->objfile_obstack); } xfree (actual_class_name); need_to_update_name = 0; @@ -3256,7 +3256,7 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu) 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[0] == '\0' ? "" : "::", @@ -3265,7 +3265,7 @@ read_enumeration (struct die_info *die, struct dwarf2_cu *cu) else { 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)) = obsavestring (SYMBOL_NATURAL_NAME (sym), strlen (SYMBOL_NATURAL_NAME (sym)), - &objfile->type_obstack); + &objfile->objfile_obstack); add_symbol_to_list (typedef_sym, list_to_add); } } diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c index 5d1518d..0452886 100644 --- a/gdb/dwarfread.c +++ b/gdb/dwarfread.c @@ -1,7 +1,7 @@ /* DWARF debugging format support for GDB. 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, 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 != '.') { - TYPE_TAG_NAME (type) = obconcat (&objfile->type_obstack, + TYPE_TAG_NAME (type) = obconcat (&objfile->objfile_obstack, "", "", dip->at_name); } /* 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. */ list->field.name = obsavestring (mbr.at_name, strlen (mbr.at_name), - &objfile->type_obstack); + &objfile->objfile_obstack); FIELD_TYPE (list->field) = decode_die_type (&mbr); FIELD_BITPOS (list->field) = 8 * locval (&mbr); FIELD_STATIC_KIND (list->field) = 0; @@ -1670,7 +1670,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) && *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); } if (dip->at_byte_size != 0) @@ -1704,7 +1704,7 @@ enum_type (struct dieinfo *dip, struct objfile *objfile) objfile); scan += TARGET_FT_LONG_SIZE (objfile); list->field.name = obsavestring (scan, strlen (scan), - &objfile->type_obstack); + &objfile->objfile_obstack); scan += strlen (scan) + 1; nfields++; /* Handcraft a new symbol for this enum member. */ diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index f98cf1c..4c24fa2 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -1,6 +1,6 @@ /* Support routines for manipulating internal types for GDB. - Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003 - Free Software Foundation, Inc. + Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 Free Software Foundation, Inc. Contributed by Cygnus Support, using pieces from other GDB modules. 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 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). */ struct type * @@ -154,10 +154,10 @@ alloc_type (struct objfile *objfile) } else { - type = obstack_alloc (&objfile->type_obstack, + type = obstack_alloc (&objfile->objfile_obstack, 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)); OBJSTAT (objfile, n_types++); } @@ -191,7 +191,7 @@ alloc_type_instance (struct type *oldtype) } else { - type = obstack_alloc (&TYPE_OBJFILE (oldtype)->type_obstack, + type = obstack_alloc (&TYPE_OBJFILE (oldtype)->objfile_obstack, 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. 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 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)) { TYPE_NAME (type) = - obsavestring (name, strlen (name), &objfile->type_obstack); + obsavestring (name, strlen (name), &objfile->objfile_obstack); } else { @@ -1793,7 +1793,7 @@ lookup_fundamental_type (struct objfile *objfile, int typeid) { nbytes = FT_NUM_MEMBERS * sizeof (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); OBJSTAT (objfile, n_types += FT_NUM_MEMBERS); } diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h index acd0ffd..a1141d7 100644 --- a/gdb/gdbtypes.h +++ b/gdb/gdbtypes.h @@ -1,7 +1,7 @@ /* Internal type definitions for GDB. 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. @@ -320,7 +320,7 @@ struct main_type char *tag_name; /* 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 it is not in the process of reading symbols from a particular objfile. 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. 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. - if the type is on an objfile's type_obstack, then the space for data - associated with that type will also be allocated on the type_obstack. + 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 objfile_obstack. If the type is not associated with any particular objfile (such as builtin types), then the data space will be allocated with xmalloc, the same as for the type structure. */ #define TYPE_ALLOC(t,size) \ (TYPE_OBJFILE (t) != NULL \ - ? obstack_alloc (&TYPE_OBJFILE (t) -> type_obstack, size) \ + ? obstack_alloc (&TYPE_OBJFILE (t) -> objfile_obstack, size) \ : xmalloc (size)) extern struct type *alloc_type (struct objfile *); diff --git a/gdb/hpread.c b/gdb/hpread.c index 246f77e..1edb81c 100644 --- a/gdb/hpread.c +++ b/gdb/hpread.c @@ -3145,7 +3145,7 @@ hpread_read_enum_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_FLAGS (type) &= ~TYPE_FLAG_STUB; TYPE_NFIELDS (type) = nsyms; 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. 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. */ TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms); /* 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. */ TYPE_NFIELDS (type) = nsyms; TYPE_FIELDS (type) = (struct field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct field) * nsyms); /* 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) 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) { n -= 1; @@ -4255,7 +4255,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_NINSTANTIATIONS (type) = ninstantiations; if (ninstantiations > 0) 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) { n -= 1; @@ -4267,7 +4267,7 @@ hpread_read_struct_type (dnttpointer hp_type, union dnttentry *dn_bufp, TYPE_NFIELDS (type) = nfields; TYPE_N_BASECLASSES (type) = n_base_classes; 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. */ 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_TOTAL (type) = n_fn_fields_total; 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) { n -= 1; @@ -4399,7 +4399,7 @@ fix_static_member_physnames (struct type *type, char *class_name, return; /* physnames are already set */ 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)); strcpy (TYPE_FIELD_STATIC_PHYSNAME (type, i), class_name); 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_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, objfile); 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_NFIELDS (type) = 2; TYPE_FIELDS (type) - = (struct field *) obstack_alloc (&objfile->type_obstack, + = (struct field *) obstack_alloc (&objfile->objfile_obstack, 2 * sizeof (struct field)); if (dn_bufp->dsubr.dyn_low) @@ -4803,7 +4803,7 @@ hpread_type_lookup (dnttpointer hp_type, struct objfile *objfile) /* Build the correct name. */ TYPE_NAME (structtype) - = (char *) obstack_alloc (&objfile->type_obstack, + = (char *) obstack_alloc (&objfile->objfile_obstack, strlen (prefix) + strlen (suffix) + 1); TYPE_NAME (structtype) = strcpy (TYPE_NAME (structtype), prefix); TYPE_NAME (structtype) = strcat (TYPE_NAME (structtype), suffix); diff --git a/gdb/jv-lang.c b/gdb/jv-lang.c index 92c263b..3d15313 100644 --- a/gdb/jv-lang.c +++ b/gdb/jv-lang.c @@ -186,7 +186,7 @@ java_lookup_class (char *name) type = alloc_type (objfile); TYPE_CODE (type) = TYPE_CODE_STRUCT; 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 ? = addr; return type; @@ -289,7 +289,7 @@ type_from_class (struct value *clas) /* if clasloader non-null, prepend loader address. FIXME */ temp = clas; 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++) { if (*nptr == '/') @@ -309,7 +309,7 @@ type_from_class (struct value *clas) char *signature = name; int namelen = java_demangled_signature_length (signature); 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); name[namelen] = '\0'; is_array = 1; @@ -442,7 +442,7 @@ java_link_class_type (struct type *type, struct value *clas) temp = field; temp = value_struct_elt (&temp, NULL, "name", NULL, "structure"); TYPE_FIELD_NAME (type, i) = - get_java_utf8_name (&objfile->type_obstack, temp); + get_java_utf8_name (&objfile->objfile_obstack, temp); temp = field; accflags = value_as_long (value_struct_elt (&temp, NULL, "accflags", NULL, "structure")); @@ -513,7 +513,7 @@ java_link_class_type (struct type *type, struct value *clas) /* Get method name. */ temp = method; 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, "") == 0) 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. */ int l; if (mname != unqualified_name) - obstack_free (&objfile->type_obstack, mname); + obstack_free (&objfile->objfile_obstack, mname); mname = fn_fieldlists[j].name; fn_fieldlists[j].length++; k = i - k; /* Index of new slot. */ diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c index ae1ea7d..a5b4d5b 100644 --- a/gdb/mdebugread.c +++ b/gdb/mdebugread.c @@ -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 || strcmp (TYPE_TAG_NAME (tp), name) != 0) TYPE_TAG_NAME (tp) = obsavestring (name, strlen (name), - ¤t_objfile->type_obstack); + ¤t_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 || strcmp (TYPE_NAME (tp), name) != 0) TYPE_NAME (tp) = obsavestring (name, strlen (name), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); } } 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_ALLOC (tp, 2 * sizeof (struct field))); TYPE_FIELD_NAME (tp, 0) = obsavestring ("Low", strlen ("Low"), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); TYPE_FIELD_BITPOS (tp, 0) = AUX_GET_DNLOW (bigend, ax); ax++; TYPE_FIELD_NAME (tp, 1) = obsavestring ("High", strlen ("High"), - ¤t_objfile->type_obstack); + ¤t_objfile->objfile_obstack); TYPE_FIELD_BITPOS (tp, 1) = AUX_GET_DNHIGH (bigend, ax); ax++; } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index fab1c99..dd18e73 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -1,7 +1,7 @@ /* GDB routines for manipulating objfiles. 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. @@ -169,7 +169,7 @@ allocate_objfile (bfd *abfd, int flags) xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, + obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); terminate_minimal_symbol_table (objfile); @@ -433,7 +433,7 @@ free_objfile (struct objfile *objfile) htab_delete (objfile->demangled_names_hash); obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); - obstack_free (&objfile->type_obstack, 0); + obstack_free (&objfile->objfile_obstack, 0); xmfree (objfile->md, objfile); objfile = NULL; } diff --git a/gdb/objfiles.h b/gdb/objfiles.h index aeb5892..62f239c 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -1,7 +1,7 @@ /* Definitions for symbol file management in GDB. 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. @@ -281,12 +281,22 @@ struct objfile 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 table from this object file. */ struct obstack psymbol_obstack; /* Partial symbols */ struct obstack symbol_obstack; /* Full symbols */ - struct obstack type_obstack; /* Types */ /* A byte cache where we can stash arbitrary "chunks" of bytes that will not change. */ @@ -509,7 +519,7 @@ extern struct objfile *symfile_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 where types are allocated are deeply buried in function call hierarchies which know nothing about objfiles, so rather than trying to pass a diff --git a/gdb/solib-sunos.c b/gdb/solib-sunos.c index b7444c6..15dc8a3 100644 --- a/gdb/solib-sunos.c +++ b/gdb/solib-sunos.c @@ -1,6 +1,6 @@ /* Handle SunOS shared libraries for GDB, the GNU Debugger. Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, - 2001 + 2001, 2004 Free Software Foundation, Inc. This file is part of GDB. @@ -149,7 +149,7 @@ allocate_rt_common_objfile (void) xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, xmalloc, + obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); objfile->name = mstrsave (objfile->md, "rt_common"); diff --git a/gdb/stabsread.c b/gdb/stabsread.c index 2a75803..3a670a4 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -1251,7 +1251,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (sym) = STRUCT_DOMAIN; if (TYPE_TAG_NAME (SYMBOL_TYPE (sym)) == 0) 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); if (synonym) @@ -1265,7 +1265,7 @@ define_symbol (CORE_ADDR valu, char *string, int desc, int type, SYMBOL_DOMAIN (typedef_sym) = VAR_DOMAIN; if (TYPE_NAME (SYMBOL_TYPE (sym)) == 0) 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); } break; @@ -1527,7 +1527,7 @@ again: return error_type (pp, objfile); } to = type_name = - (char *) obstack_alloc (&objfile->type_obstack, p - *pp + 1); + (char *) obstack_alloc (&objfile->objfile_obstack, p - *pp + 1); /* Copy the name. */ from = *pp + 1; @@ -1554,7 +1554,7 @@ again: && (TYPE_CODE (SYMBOL_TYPE (sym)) == code) && 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); if (typenums[0] != -1) *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); memset (destr_fnlist, 0, sizeof (struct next_fnfieldlist)); destr_fnlist->fn_fieldlist.name - = obconcat (&objfile->type_obstack, "", "~", + = obconcat (&objfile->objfile_obstack, "", "~", new_fnlist->fn_fieldlist.name); 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); memset (destr_fnlist->fn_fieldlist.fn_fields, 0, sizeof (struct fn_field) * has_destructor); @@ -2576,11 +2576,11 @@ read_member_functions (struct field_info *fip, char **pp, struct type *type, if (ret) new_fnlist->fn_fieldlist.name = obsavestring (dem_opname, strlen (dem_opname), - &objfile->type_obstack); + &objfile->objfile_obstack); } new_fnlist->fn_fieldlist.fn_fields = (struct fn_field *) - obstack_alloc (&objfile->type_obstack, + obstack_alloc (&objfile->objfile_obstack, sizeof (struct fn_field) * length); memset (new_fnlist->fn_fieldlist.fn_fields, 0, sizeof (struct fn_field) * length); @@ -2649,7 +2649,7 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, name = ""; } fip->list->field.name = - obconcat (&objfile->type_obstack, vptr_name, name, ""); + obconcat (&objfile->objfile_obstack, vptr_name, name, ""); break; case 'b': /* $vb -- a virtual bsomethingorother */ @@ -2662,13 +2662,13 @@ read_cpp_abbrev (struct field_info *fip, char **pp, struct type *type, name = "FOO"; } fip->list->field.name = - obconcat (&objfile->type_obstack, vb_name, name, ""); + obconcat (&objfile->objfile_obstack, vb_name, name, ""); break; default: invalid_cpp_abbrev_complaint (*pp); fip->list->field.name = - obconcat (&objfile->type_obstack, + obconcat (&objfile->objfile_obstack, "INVALID_CPLUSPLUS_ABBREV", "", ""); break; } @@ -2714,7 +2714,7 @@ read_one_struct_field (struct field_info *fip, char **pp, char *p, struct type *type, struct objfile *objfile) { fip->list->field.name = - obsavestring (*pp, p - *pp, &objfile->type_obstack); + obsavestring (*pp, p - *pp, &objfile->objfile_obstack); *pp = p + 1; /* This means we have a visibility for a field coming. */ diff --git a/gdb/symfile.c b/gdb/symfile.c index 076fc45..1aa5ff7 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -1913,7 +1913,7 @@ reread_symbols (void) } obstack_free (&objfile->psymbol_obstack, 0); obstack_free (&objfile->symbol_obstack, 0); - obstack_free (&objfile->type_obstack, 0); + obstack_free (&objfile->objfile_obstack, 0); objfile->sections = NULL; objfile->symtabs = NULL; objfile->psymtabs = NULL; @@ -1943,7 +1943,7 @@ reread_symbols (void) xmalloc, xfree); obstack_specify_allocation (&objfile->symbol_obstack, 0, 0, xmalloc, xfree); - obstack_specify_allocation (&objfile->type_obstack, 0, 0, + obstack_specify_allocation (&objfile->objfile_obstack, 0, 0, xmalloc, xfree); if (build_objfile_section_table (objfile)) { diff --git a/gdb/symmisc.c b/gdb/symmisc.c index 76b3507..10274d0 100644 --- a/gdb/symmisc.c +++ b/gdb/symmisc.c @@ -1,7 +1,7 @@ /* Do various things to symbol tables (other than lookup), for GDB. 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. This file is part of GDB. @@ -239,7 +239,7 @@ print_objfile_statistics (void) printf_filtered (" Total memory used for symbol obstack: %d\n", obstack_memory_used (&objfile->symbol_obstack)); printf_filtered (" Total memory used for type obstack: %d\n", - obstack_memory_used (&objfile->type_obstack)); + obstack_memory_used (&objfile->objfile_obstack)); } immediate_quit--; } -- cgit v1.1