From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14609 invoked by alias); 14 Jul 2014 18:02:43 -0000 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 Received: (qmail 14590 invoked by uid 89); 14 Jul 2014 18:02:42 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 14 Jul 2014 18:02:40 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s6EI2dan015625 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 14 Jul 2014 14:02:39 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s6EI2cto022639; Mon, 14 Jul 2014 14:02:38 -0400 Message-ID: <53C41B3D.3060508@redhat.com> Date: Mon, 14 Jul 2014 18:12:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: Jan Kratochvil CC: gdb-patches@sourceware.org Subject: Re: [patchv3] Fix crash on optimized-out entry data values References: <20140709103312.GA27884@host2.jankratochvil.net> <53BD2CE0.1000308@redhat.com> <20140709153121.GA7989@host2.jankratochvil.net> <20140711153757.GA452@host2.jankratochvil.net> In-Reply-To: <20140711153757.GA452@host2.jankratochvil.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-SW-Source: 2014-07/txt/msg00346.txt.bz2 On 07/11/2014 04:37 PM, Jan Kratochvil wrote: > On Wed, 09 Jul 2014 17:31:21 +0200, Jan Kratochvil wrote: >> On Wed, 09 Jul 2014 13:52:00 +0200, Pedro Alves wrote: >>> On 07/09/2014 11:33 AM, Jan Kratochvil wrote: >>>> --- a/gdb/value.c >>>> +++ b/gdb/value.c >>>> @@ -198,12 +198,13 @@ struct value >>>> unsigned int lazy : 1; >>>> >>>> /* If nonzero, this is the value of a variable that does not >>>> - actually exist in the program. If nonzero, and LVAL is >>>> + actually fully exist in the program. If nonzero, and LVAL is >>>> lval_register, this is a register ($pc, $sp, etc., never a >>>> program variable) that has not been saved in the frame. All >>>> optimized-out values are treated pretty much the same, except >>>> registers have a different string representation and related >>>> - error strings. */ >>>> + error strings. It is true also for only partially optimized >>>> + out variables - see the 'unavailable' field below. */ >>>> unsigned int optimized_out : 1; >>>> >>>> /* If value is a variable, is it initialized or not. */ >>>> @@ -334,7 +335,10 @@ struct value >>>> valid if lazy is nonzero. */ >>>> gdb_byte *contents; >>>> >>>> - /* Unavailable ranges in CONTENTS. We mark unavailable ranges, >>>> + /* If OPTIMIZED_OUT is false then UNAVAILABLE must be VEC_empty >>>> + (not necessarily NULL). >>> >>> Hmm, why? We can collect only part of a non-optimized out value. >>> What am I missing? >> >> I miss some documentation how these availability fields interact together. > > From a comment in mail > Message-Id: <201102071427.55970.pedro@codesourcery.com> > We give preference to printing rather > than , since if a value had been optimized out > at compile time, it can never be collected at run-time. > > it seems it is just reversed, that 'unavailable' can exist only for > !optimized_out and it cannot exist for for optimized_out values. Not really true either. A value can be partially optimized out. And then when e.g., inspecting a traceframe or a partial core dump, the bits that are not optimized out may well not have been collected, so those will be unavailable. I'm sending you a different patch in a bit. -- Pedro Alves