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]

[dictionary] handle anonymous classes/structs


When I wrote code to figure out the class/namespace that a DIE lives
in in dwarf2read.c, I neglected to handle the case of anonymous
classes/structs.  I'm actually not sure what the best thing to do here
is - I'll have to go over read_structure_scope more carefully - but
this patch should handle the situation for now.

David Carlton
carlton@bactrian.org

2003-05-28  David Carlton  <carlton@bactrian.org>

	* dwarf2read.c (determine_prefix): Handle anonymous
	classes/structures.

Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.66.4.27
diff -u -p -r1.66.4.27 dwarf2read.c
--- dwarf2read.c	23 May 2003 18:40:36 -0000	1.66.4.27
+++ dwarf2read.c	28 May 2003 22:28:30 -0000
@@ -6030,9 +6030,18 @@ determine_prefix (struct die_info *die)
       case DW_TAG_class_type:
       case DW_TAG_structure_type:
 	{
-
 	  if (parent_prefix != NULL)
-	    return typename_concat (parent_prefix, dwarf2_name (parent));
+	    {
+	      const char *parent_name = dwarf2_name (parent);
+
+	      if (parent_name != NULL)
+		return typename_concat (parent_prefix, dwarf2_name (parent));
+	      else
+		/* FIXME: carlton/2003-05-28: I'm not sure what the
+		   best thing to do here is.  */
+		return typename_concat (parent_prefix,
+					"<<anonymous class>>");
+	    }
 	  else
 	    return class_name (parent);
 	}


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