From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10180 invoked by alias); 21 Mar 2011 14:47:38 -0000 Received: (qmail 10039 invoked by uid 22791); 21 Mar 2011 14:47:35 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_XZ X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 21 Mar 2011 14:47:25 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 2153B2BAE7E; Mon, 21 Mar 2011 10:47:24 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id cTRzsFlvTMF1; Mon, 21 Mar 2011 10:47:24 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id E976F2BAE6B; Mon, 21 Mar 2011 10:47:23 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id 2097C1459AD; Mon, 21 Mar 2011 07:47:16 -0700 (PDT) Date: Mon, 21 Mar 2011 15:06:00 -0000 From: Joel Brobecker To: Jan Kratochvil Cc: gdb-patches@sourceware.org Subject: Re: [patch] ada: Fix rashes on gdbarch garbage Message-ID: <20110321144716.GD2520@adacore.com> References: <20110320203350.GA30841@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110320203350.GA30841@host1.jankratochvil.net> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00953.txt.bz2 Hi Jan, Thanks for the investigative work! > gdb/ > 2011-03-20 Jan Kratochvil > > * 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 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 + + * ada-lang.c (replace_operator_with_call): Use xzalloc instead + of xmalloc. + 2012-03-18 Pedro Alves * 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;