From: Tom Tromey <tromey@redhat.com>
To: gdb-patches@sourceware.org
Subject: RFA: fix crash-causing bug in copy_type_recursive
Date: Mon, 10 Nov 2008 20:08:00 -0000 [thread overview]
Message-ID: <m3iqqvjrou.fsf@fleche.redhat.com> (raw)
On the Python branch I ran into a crash that was caused by
copy_type_recursive not clearing the memory for new fields. This was
probably introduced when I changed all the type flags back in August,
but I didn't research to see for sure.
The fix is to clear the newly allocated memory.
Every other places that allocates new fields does this.
I do not have a test failing case for trunk.
Built and regtested on x86-64 (compile farm).
Ok? (I almost checked this in as obvious...)
Tom
2008-11-10 Tom Tromey <tromey@redhat.com>
* gdbtypes.c (copy_type_recursive): Clear new fields.
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b5a5de0..5b9d0e8 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -2977,6 +2977,7 @@ copy_type_recursive (struct objfile *objfile,
nfields = TYPE_NFIELDS (type);
TYPE_FIELDS (new_type) = xmalloc (sizeof (struct field) * nfields);
+ memset (TYPE_FIELDS (new_type), 0, sizeof (struct field) * nfields);
for (i = 0; i < nfields; i++)
{
TYPE_FIELD_ARTIFICIAL (new_type, i) =
next reply other threads:[~2008-11-10 19:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-10 20:08 Tom Tromey [this message]
2008-11-10 20:57 ` Daniel Jacobowitz
2008-11-10 21:22 ` Pedro Alves
2008-11-10 21:26 ` Tom Tromey
2008-11-10 23:10 ` Pedro Alves
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=m3iqqvjrou.fsf@fleche.redhat.com \
--to=tromey@redhat.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