aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Fish <fnf@specifix.com>1991-11-22 02:30:34 +0000
committerFred Fish <fnf@specifix.com>1991-11-22 02:30:34 +0000
commit4cfd3c49904429c595c893db2c733bb66fe689e5 (patch)
tree5588081791e55bed656c21e4c8752b7ba292a7a1
parent9fb2bebda97ea8f7a52a6f582339c9a497101363 (diff)
downloadgdb-4cfd3c49904429c595c893db2c733bb66fe689e5.zip
gdb-4cfd3c49904429c595c893db2c733bb66fe689e5.tar.gz
gdb-4cfd3c49904429c595c893db2c733bb66fe689e5.tar.bz2
Initialize the c++ specific portion of the type structure for union types
as well as struct types, since gdb attempts to reference that portion for both types. Was getting core dumps due to NULL pointer dereferencing.
-rw-r--r--gdb/ChangeLog6
-rw-r--r--gdb/dwarfread.c32
2 files changed, 24 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index d0de7a8..7541ac3 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,9 @@
+Thu Nov 21 18:26:11 1991 Fred Fish (fnf at cygnus.com)
+
+ * dwarfread.c (struct_type): Must initialize the c++ specific
+ portion of union types as well as struct types, since gdb attempts
+ to reference the c++ specific info for both types.
+
Thu Nov 21 10:23:52 1991 John Gilmore (gnu at cygnus.com)
* defs.h: Incorporate param.h. All users changed.
diff --git a/gdb/dwarfread.c b/gdb/dwarfread.c
index 44e8ccf..fcc2f35 100644
--- a/gdb/dwarfread.c
+++ b/gdb/dwarfread.c
@@ -901,24 +901,28 @@ DEFUN(struct_type, (dip, thisdie, enddie),
{
type = alloc_utype (dip -> dieref, NULL);
}
- switch (dip -> dietag)
+ if (dip -> dietag == TAG_structure_type || dip -> dietag == TAG_union_type)
+ {
+ TYPE_CPLUS_SPECIFIC (type) = (struct cplus_struct_type *)
+ obstack_alloc (symbol_obstack, sizeof (struct cplus_struct_type));
+ (void) memset (TYPE_CPLUS_SPECIFIC (type), 0,
+ sizeof (struct cplus_struct_type));
+ if (dip -> dietag == TAG_structure_type)
+ {
+ TYPE_CODE (type) = TYPE_CODE_STRUCT;
+ tpart1 = "struct ";
+ }
+ else
+ {
+ TYPE_CODE (type) = TYPE_CODE_UNION;
+ tpart1 = "union ";
+ }
+ }
+ else
{
- case TAG_structure_type:
- TYPE_CODE (type) = TYPE_CODE_STRUCT;
- TYPE_CPLUS_SPECIFIC (type)
- = (struct cplus_struct_type *) obstack_alloc (symbol_obstack, sizeof (struct cplus_struct_type));
- bzero (TYPE_CPLUS_SPECIFIC (type), sizeof (struct cplus_struct_type));
- tpart1 = "struct ";
- break;
- case TAG_union_type:
- TYPE_CODE (type) = TYPE_CODE_UNION;
- tpart1 = "union ";
- break;
- default:
tpart1 = "";
SQUAWK (("missing structure or union tag"));
TYPE_CODE (type) = TYPE_CODE_UNDEF;
- break;
}
/* Some compilers try to be helpful by inventing "fake" names for anonymous
enums, structures, and unions, like "~0fake". Thanks, but no thanks. */