From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] ada: Fix rashes on gdbarch garbage
Date: Mon, 21 Mar 2011 15:06:00 -0000 [thread overview]
Message-ID: <20110321144716.GD2520@adacore.com> (raw)
In-Reply-To: <20110320203350.GA30841@host1.jankratochvil.net>
Hi Jan,
Thanks for the investigative work!
> gdb/
> 2011-03-20 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> * ada-lang.c (replace_operator_with_call): Copy also GDBARCH.
This change looks definitely correct to me, so I've checked it in.
It's strange that I am not able to reproduce it, even after I changed
the xmalloc to xzalloc...
To prevent any further fields from being undefined, I have also
checked the following patch in.
gdb/ChangeLog:
* ada-lang.c (replace_operator_with_call): Use xzalloc instead
of xmalloc.
Tested on x86_64-linux.
--
Joel
commit 6cb8c1c196651db26b01653b688547a203089162
Author: Joel Brobecker <brobecker@adacore.com>
Date: Mon Mar 21 07:36:17 2011 -0700
use xzalloc in ada-lang.c:replace_operator_with_call
This is to make sure that we cannot have a field with an undefined
value (currently, we are not setting the gdbarch).
gdb/ChangeLog:
* ada-lang.c (replace_operator_with_call): Use xzalloc instead
of xmalloc.
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 64d8391..d79197e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2012-03-21 Joel Brobecker <brobecker@adacore.com>
+
+ * ada-lang.c (replace_operator_with_call): Use xzalloc instead
+ of xmalloc.
+
2012-03-18 Pedro Alves <pedro@codesourcery.com>
* frame.c (frame_unwind_register): Throw an error if unwinding the
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 3746edc..93711cf 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -3659,7 +3659,7 @@ replace_operator_with_call (struct expression **expp, int pc, int nargs,
/* A new expression, with 6 more elements (3 for funcall, 4 for function
symbol, -oplen for operator being replaced). */
struct expression *newexp = (struct expression *)
- xmalloc (sizeof (struct expression)
+ xzalloc (sizeof (struct expression)
+ EXP_ELEM_TO_BYTES ((*expp)->nelts + 7 - oplen));
struct expression *exp = *expp;
next prev parent reply other threads:[~2011-03-21 14:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-21 10:46 Jan Kratochvil
2011-03-21 15:06 ` Joel Brobecker [this message]
2011-03-21 15:39 ` Jan Kratochvil
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=20110321144716.GD2520@adacore.com \
--to=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/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