From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18352 invoked by alias); 10 Oct 2011 21:40:50 -0000 Received: (qmail 18333 invoked by uid 22791); 10 Oct 2011 21:40:49 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 10 Oct 2011 21:40:32 +0000 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=EU1-MAIL.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1RDNaK-0002KF-3O from pedro_alves@mentor.com ; Mon, 10 Oct 2011 14:40:32 -0700 Received: from scottsdale.localnet ([172.16.63.104]) by EU1-MAIL.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.1830); Mon, 10 Oct 2011 22:40:30 +0100 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] Fix internal error on optimized-out values (regression by me) Date: Mon, 10 Oct 2011 21:40:00 -0000 User-Agent: KMail/1.13.6 (Linux/2.6.38-11-generic; KDE/4.7.1; x86_64; ; ) Cc: Jan Kratochvil , Tom Tromey References: <20110926191132.GA30401@host1.jankratochvil.net> <20111010205407.GA5193@host1.jankratochvil.net> In-Reply-To: <20111010205407.GA5193@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201110102240.28440.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: 2011-10/txt/msg00288.txt.bz2 On Monday 10 October 2011 21:54:08, Jan Kratochvil wrote: > On Mon, 03 Oct 2011 21:34:16 +0200, Tom Tromey wrote: > > >>>>> "Jan" == Jan Kratochvil writes: > > > > Jan> ((struct) ).field should be IMO still > Jan> out>; just it became internal-error now. > > > > Maybe I am misunderstanding what you are saying -- I think this should > > also throw. I think the rule should be that any attempt to access any > > "invalid" contents of a value, for purposes of computation, should throw > > an exception. > > Here is problematic the term "for purposes of computation". > > I agree that any computation with content of must throw. > > But here the content is not interpreted in any way. Only a smaller subset of > it is used. > > > But I do not have any argument why the former value is better > than this "value has been optimized out", unaware if there is a precedent for > either way in current codebase. Changed it as you suggest. IMO, this is just like "p s.f", printing when the whole of `s' is unavailable. From the unavailable.exp test: print globalstruct.memberf $7 = (gdb) PASS: gdb.trace/unavailable.exp: collect globals: print globalstruct.memberf print globalstruct.memberd print globalstruct $9 = {memberc = , memberi = , memberf = , memberd = } It just happens that today, we only support either wholy optimized-out values, or wholly not optimized-out values. A compiler can flatten out structures and optimize out just some unused fields (of local vars, most usefully). When we get to support that, it'll follow naturally that a single optimized out flag per value isn't sufficient, and that ((struct) ).field will need to be able to be . -- Pedro Alves