From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24607 invoked by alias); 1 Jul 2010 15:57:45 -0000 Received: (qmail 24597 invoked by uid 22791); 1 Jul 2010 15:57:44 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,TW_DL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 01 Jul 2010 15:57:39 +0000 Received: (qmail 25738 invoked from network); 1 Jul 2010 15:57:38 -0000 Received: from unknown (HELO orlando.localnet) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 1 Jul 2010 15:57:38 -0000 From: Pedro Alves To: tromey@redhat.com Subject: Re: collecting optimized out variables regression (Re: RFA: rewrite dwarf->ax translator Date: Thu, 01 Jul 2010 15:57:00 -0000 User-Agent: KMail/1.13.2 (Linux/2.6.31-10-rt; KDE/4.4.2; x86_64; ; ) Cc: gdb-patches@sourceware.org, Stan Shebs , Jan Kratochvil References: <201007011343.00392.pedro@codesourcery.com> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201007011657.36107.pedro@codesourcery.com> X-IsSubscribed: yes 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: 2010-07/txt/msg00013.txt.bz2 On Thursday 01 July 2010 16:24:58, Tom Tromey wrote: > >>>>> "Pedro" == Pedro Alves writes: > > >> - if (!data || size == 0) > >> - { > >> - value->optimized_out = 1; > >> - return; > >> - } > > Pedro> Apparently, this bit was lost with the rewrite. > > Oops, sorry about that. > > Pedro> This patch fixes it for me. Is this the correct approach, or > Pedro> maybe there was intent to handle this differently? > > It looks good to me. Thanks, I've applied it. On Thursday 01 July 2010 16:33:50, Jan Kratochvil wrote: > On Thu, 01 Jul 2010 14:42:59 +0200, Pedro Alves wrote: > > + if (dlbaton->data == NULL || dlbaton->size == 0) > > If SIZE != 0 then DATA must be != NULL otherwise GDB would crash elsewhere. Maybe in the case, I'm not sure. In the loclist case, it can be seen that SIZE is undefined when DATA is NULL (see the internal error example I posted before), so checking on SIZE isn't sufficient then. I was prefering having both cases handled with the same condition, and I used the same condition we were using before the rewrite. > dwarf2_evaluate_loc_desc is already using this easier to read conditional: > if (size == 0) > which means: > if (dlbaton->size == 0) ... while loclist_read_variable itself checks for data == NULL. That didn't seem that consistent and easier to read. (Feel free to clean this up. I'm disappearing for two weeks soon, and I really should be focusing on other stuff. I've applied it as is, mainly to avoid branching 7.2 with the regression.) Thanks, -- Pedro Alves