summaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/gdbtypes.c26
-rw-r--r--gdb/gdbtypes.h2
-rw-r--r--gdb/stabsread.c8
4 files changed, 42 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 29dbf495ba5..3b1edb3e606 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-03 Daniel Jacobowitz <drow@mvista.com>
+
+ PR gdb/280
+ * gdbtypes.c (replace_type): New function.
+ * gdbtypes.h (replace_type): Add prototype.
+ * stabsread.c (read_type): Use replace_type.
+
2002-02-03 Richard Earnshaw <rearnsha@arm.com>
* Makefile.in (memattr.o): Add missing dependencies rule.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b6de34c26ef..435718f5d62 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -519,6 +519,32 @@ finish_cv_type (struct type *type)
}
}
+/* Replace the contents of ntype with the type *type.
+
+ This function should not be necessary, but is due to quirks in the stabs
+ reader. This should go away. It does not handle the replacement type
+ being cv-qualified; it could be easily fixed to, but it should go away,
+ remember? */
+void
+replace_type (struct type *ntype, struct type *type)
+{
+ struct type *cv_chain, *as_chain, *ptr, *ref;
+
+ cv_chain = TYPE_CV_TYPE (ntype);
+ as_chain = TYPE_AS_TYPE (ntype);
+ ptr = TYPE_POINTER_TYPE (ntype);
+ ref = TYPE_REFERENCE_TYPE (ntype);
+
+ *ntype = *type;
+
+ TYPE_POINTER_TYPE (ntype) = ptr;
+ TYPE_REFERENCE_TYPE (ntype) = ref;
+ TYPE_CV_TYPE (ntype) = cv_chain;
+ TYPE_AS_TYPE (ntype) = as_chain;
+
+ finish_cv_type (ntype);
+}
+
/* Implement direct support for MEMBER_TYPE in GNU C++.
May need to construct such a type if this is the first use.
The TYPE is the type of the member. The DOMAIN is the type
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 85dbb7bad5a..74b521abb67 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1062,6 +1062,8 @@ extern struct type *make_cv_type (int, int, struct type *, struct type **);
extern void finish_cv_type (struct type *);
+extern void replace_type (struct type *, struct type *);
+
extern int address_space_name_to_int (char *);
extern char *address_space_int_to_name (int);
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index 62b8bfecb27..ec931c0639b 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2531,7 +2531,13 @@ again:
}
else if (type_size >= 0 || is_string)
{
- *type = *xtype;
+ /* This is the absolute wrong way to construct types. Every
+ other debug format has found a way around this problem and
+ the related problems with unnecessarily stubbed types;
+ someone motivated should attempt to clean up the issue
+ here as well. Once a type pointed to has been created it
+ should not be modified. */
+ replace_type (type, xtype);
TYPE_NAME (type) = NULL;
TYPE_TAG_NAME (type) = NULL;
}