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]

RFA: Fix a crasher in dwarfread.c


Having gotten two reports of this, I figure we might as well at least not
segfault on it.  Diab's C++ compiler, may it rot in the depths of something
or other for producing DWARF 1, emits static members differently from GCC. 
GCC's we just ignore the static fields.  Diab's we crash.

Neither is good; but I don't really care about dwarfread enough to fix the
former, so this converts the latter into the former.  OK?

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

2003-06-14  Daniel Jacobowitz  <drow@mvista.com>

	PR gdb/1179
	* dwarfread.c (struct_type): Skip static fields without crashing.

Index: dwarfread.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarfread.c,v
retrieving revision 1.27
diff -u -p -r1.27 dwarfread.c
--- dwarfread.c	11 Jun 2003 22:27:12 -0000	1.27
+++ dwarfread.c	14 Jun 2003 22:28:10 -0000
@@ -979,6 +979,13 @@ struct_type (struct dieinfo *dip, char *
       switch (mbr.die_tag)
 	{
 	case TAG_member:
+	  /* Static fields can be either TAG_global_variable (GCC) or else
+	     TAG_member with no location (Diab).  We could treat the latter like
+	     the former... but since we don't support the former, just avoid
+	     crashing on the latter for now.  */
+	  if (mbr.at_location == NULL)
+	    break;
+
 	  /* Get space to record the next field's data.  */
 	  new = (struct nextfield *) alloca (sizeof (struct nextfield));
 	  new->next = list;


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