From: Joel Brobecker <brobecker@adacore.com>
To: gdb-patches@sourceware.org
Subject: [RFA] wrong pointer type length part 2 (of 2)
Date: Thu, 17 May 2007 18:51:00 -0000 [thread overview]
Message-ID: <20070517185144.GD508@adacore.com> (raw)
In-Reply-To: <20070517163951.GB508@adacore.com>
[-- Attachment #1: Type: text/plain, Size: 720 bytes --]
> > > As a followup to this patch, I think that the same needs to be done
> > > for at least make_reference_type, but I don't have hard evidence that
> > > this will ever be needed right now. If it is agreed that this function
> > > also needs an update, it can be made independently in a followup patch.
> >
> > Yes please.
>
> I'm working on the second part right now...
OK, here is the second part that deals with reference types.
2007-05-17 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.c (make_reference_type): Preserve the type chain
and set the length of all the variants of the pointer type.
Tested on x86-linux (elf/dwarf), and ppc-aix (xcoff/stabs).
OK to commit?
Thanks,
--
Joel
[-- Attachment #2: reftype.diff --]
[-- Type: text/plain, Size: 1173 bytes --]
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.115
diff -u -p -r1.115 gdbtypes.c
--- gdbtypes.c 17 May 2007 16:38:25 -0000 1.115
+++ gdbtypes.c 17 May 2007 16:40:53 -0000
@@ -354,6 +354,7 @@ make_reference_type (struct type *type,
{
struct type *ntype; /* New type */
struct objfile *objfile;
+ struct type *chain;
ntype = TYPE_REFERENCE_TYPE (type);
@@ -379,7 +380,9 @@ make_reference_type (struct type *type,
{
ntype = *typeptr;
objfile = TYPE_OBJFILE (ntype);
+ chain = TYPE_CHAIN (ntype);
smash_type (ntype);
+ TYPE_CHAIN (ntype) = chain;
TYPE_OBJFILE (ntype) = objfile;
}
@@ -395,6 +398,14 @@ make_reference_type (struct type *type,
if (!TYPE_REFERENCE_TYPE (type)) /* Remember it, if don't have one. */
TYPE_REFERENCE_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;
}
next prev parent reply other threads:[~2007-05-17 18:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-17 16:19 [RFA] wrong pointer type length Joel Brobecker
2007-05-17 16:27 ` Daniel Jacobowitz
2007-05-17 16:42 ` Joel Brobecker
2007-05-17 18:51 ` Joel Brobecker [this message]
2007-05-17 20:07 ` [RFA] wrong pointer type length part 2 (of 2) Daniel Jacobowitz
2007-05-17 20:16 ` Joel Brobecker
2007-05-17 17:01 ` [RFA] wrong pointer type length Jim Blandy
2007-05-17 17:23 ` Joel Brobecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070517185144.GD508@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox