This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH/ob] unify objfile obstacks (1/4)


This patch 
1. adds a new member to the objfile structure, objfile_obstack.
2. removes the type_obstack member.
3. moves all the uses of type_obstack to use obfile_obstack.

pretty mechanical.

Next in the series will be migrating psymbol_obstack to
objfile_obstack. Then migrate symbol_obstack to objfile_obstack.
Last, fix the testsuite,

elena

2004-02-06  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 symfile_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.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.130
diff -u -p -r1.130 dwarf2read.c
--- dwarf2read.c	28 Jan 2004 18:43:06 -0000	1.130
+++ dwarf2read.c	6 Feb 2004 19:10:07 -0000
@@ -2666,7 +2666,7 @@ dwarf2_add_field (struct field_info *fip
       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
       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 
   /* 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 *d
 	     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 *d
       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 *d
 		      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, 
 
       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, 
       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_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);
 	      }
 	  }
Index: dwarfread.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarfread.c,v
retrieving revision 1.33
diff -u -p -r1.33 dwarfread.c
--- dwarfread.c	1 Dec 2003 22:03:12 -0000	1.33
+++ dwarfread.c	6 Feb 2004 19:10:10 -0000
@@ -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 *
       && *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 *
 	  /* 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 o
       && *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 o
 			    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. */
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.79
diff -u -p -r1.79 gdbtypes.c
--- gdbtypes.c	21 Jan 2004 04:11:16 -0000	1.79
+++ gdbtypes.c	6 Feb 2004 19:10:14 -0000
@@ -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 (struc
 
 /* 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 *oldtyp
     }
   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 
 /* 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 leng
   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 
     {
       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);
     }
Index: gdbtypes.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.h,v
retrieving revision 1.51
diff -u -p -r1.51 gdbtypes.h
--- gdbtypes.h	11 Sep 2003 19:49:18 -0000	1.51
+++ gdbtypes.h	6 Feb 2004 19:10:16 -0000
@@ -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 *);
Index: hpread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpread.c,v
retrieving revision 1.42
diff -u -p -r1.42 hpread.c
--- hpread.c	7 Jan 2004 13:22:09 -0000	1.42
+++ hpread.c	6 Feb 2004 19:10:23 -0000
@@ -3145,7 +3145,7 @@ hpread_read_enum_type (dnttpointer hp_ty
   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 h
   /* 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 (dnttpoint
   /* 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_
 
   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_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_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_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
 	  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_t
    */
   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 h
   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,
 
 	/* 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);
Index: jv-lang.c
===================================================================
RCS file: /cvs/src/src/gdb/jv-lang.c,v
retrieving revision 1.27
diff -u -p -r1.27 jv-lang.c
--- jv-lang.c	23 Jan 2004 23:03:29 -0000	1.27
+++ jv-lang.c	6 Feb 2004 19:10:24 -0000
@@ -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,
       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,
       /* 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, "<init>") == 0)
 	mname = unqualified_name;
 
@@ -538,7 +538,7 @@ java_link_class_type (struct type *type,
 	    {			/* 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. */
Index: mdebugread.c
===================================================================
RCS file: /cvs/src/src/gdb/mdebugread.c,v
retrieving revision 1.56
diff -u -p -r1.56 mdebugread.c
--- mdebugread.c	18 Jan 2004 03:42:28 -0000	1.56
+++ mdebugread.c	6 Feb 2004 19:10:29 -0000
@@ -1637,7 +1637,7 @@ parse_type (int fd, union aux_ext *ax, u
 	  else if (TYPE_TAG_NAME (tp) == NULL
 		   || strcmp (TYPE_TAG_NAME (tp), name) != 0)
 	    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, u
 	  if (TYPE_NAME (tp) == NULL
 	      || strcmp (TYPE_NAME (tp), name) != 0)
 	    TYPE_NAME (tp) = obsavestring (name, strlen (name),
-					   &current_objfile->type_obstack);
+					   &current_objfile->objfile_obstack);
 	}
     }
   if (t->bt == btTypedef)
@@ -1697,11 +1697,11 @@ parse_type (int fd, union aux_ext *ax, u
       TYPE_FIELDS (tp) = ((struct field *)
 			  TYPE_ALLOC (tp, 2 * sizeof (struct field)));
       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);
       ax++;
       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);
       ax++;
     }
Index: objfiles.c
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.c,v
retrieving revision 1.44
diff -u -p -r1.44 objfiles.c
--- objfiles.c	19 Jan 2004 19:56:01 -0000	1.44
+++ objfiles.c	6 Feb 2004 19:10:30 -0000
@@ -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;
 }
Index: objfiles.h
===================================================================
RCS file: /cvs/src/src/gdb/objfiles.h,v
retrieving revision 1.30
diff -u -p -r1.30 objfiles.h
--- objfiles.h	4 Feb 2004 16:34:51 -0000	1.30
+++ objfiles.h	6 Feb 2004 19:10:31 -0000
@@ -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
Index: solib-sunos.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-sunos.c,v
retrieving revision 1.10
diff -u -p -r1.10 solib-sunos.c
--- solib-sunos.c	1 Jun 2003 23:00:55 -0000	1.10
+++ solib-sunos.c	6 Feb 2004 19:10:32 -0000
@@ -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");
 
Index: stabsread.c
===================================================================
RCS file: /cvs/src/src/gdb/stabsread.c,v
retrieving revision 1.72
diff -u -p -r1.72 stabsread.c
--- stabsread.c	19 Jan 2004 01:20:11 -0000	1.72
+++ stabsread.c	6 Feb 2004 19:10:37 -0000
@@ -1251,7 +1251,7 @@ define_symbol (CORE_ADDR valu, char *str
       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 *str
 	  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
 	      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
 	      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,
 		  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,
 	      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
 		       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. */
Index: symfile.c
===================================================================
RCS file: /cvs/src/src/gdb/symfile.c,v
retrieving revision 1.117
diff -u -p -r1.117 symfile.c
--- symfile.c	23 Jan 2004 17:56:46 -0000	1.117
+++ symfile.c	6 Feb 2004 19:10:40 -0000
@@ -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))
 		{
Index: symmisc.c
===================================================================
RCS file: /cvs/src/src/gdb/symmisc.c,v
retrieving revision 1.26
diff -u -p -r1.26 symmisc.c
--- symmisc.c	8 Nov 2003 00:13:03 -0000	1.26
+++ symmisc.c	6 Feb 2004 19:10:42 -0000
@@ -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--;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]