summaryrefslogtreecommitdiff
path: root/gdb/gdbtypes.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2007-05-17 16:38:25 +0000
committerJoel Brobecker <brobecker@gnat.com>2007-05-17 16:38:25 +0000
commitca936980fe6705b4230ca158b5c97de1e6669d4f (patch)
treed4fe2fdb181006f44fb37bb6c89c6aae8cde4fe0 /gdb/gdbtypes.c
parentb12b7d70ed9b348450847ff28107387883a64a13 (diff)
downloadgdb-ca936980fe6705b4230ca158b5c97de1e6669d4f.tar.gz
* gdbtypes.c (make_pointer_type): Preserve the pointer type chain
and set the length of all the variants of the pointer type.
Diffstat (limited to 'gdb/gdbtypes.c')
-rw-r--r--gdb/gdbtypes.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index f2155584514..f43983a072a 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -276,6 +276,7 @@ make_pointer_type (struct type *type, struct type **typeptr)
{
struct type *ntype; /* New type */
struct objfile *objfile;
+ struct type *chain;
ntype = TYPE_POINTER_TYPE (type);
@@ -301,7 +302,9 @@ make_pointer_type (struct type *type, struct type **typeptr)
{
ntype = *typeptr;
objfile = TYPE_OBJFILE (ntype);
+ chain = TYPE_CHAIN (ntype);
smash_type (ntype);
+ TYPE_CHAIN (ntype) = chain;
TYPE_OBJFILE (ntype) = objfile;
}
@@ -321,6 +324,14 @@ make_pointer_type (struct type *type, struct type **typeptr)
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */
TYPE_POINTER_TYPE (type) = ntype;
+ /* Update the length of all the other variants of this type. */
+ chain = TYPE_CHAIN (ntype);
+ while (chain != ntype)
+ {
+ TYPE_LENGTH (chain) = TYPE_LENGTH (ntype);
+ chain = TYPE_CHAIN (chain);
+ }
+
return ntype;
}