From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5243 invoked by alias); 28 Nov 2006 11:21:05 -0000 Received: (qmail 5197 invoked by uid 22791); 28 Nov 2006 11:21:03 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0506.google.com (HELO wx-out-0506.google.com) (66.249.82.233) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 28 Nov 2006 11:20:56 +0000 Received: by wx-out-0506.google.com with SMTP id h26so2050256wxd for ; Tue, 28 Nov 2006 03:20:55 -0800 (PST) Received: by 10.70.42.16 with SMTP id p16mr1435330wxp.1164712855008; Tue, 28 Nov 2006 03:20:55 -0800 (PST) Received: by 10.70.12.7 with HTTP; Tue, 28 Nov 2006 03:20:54 -0800 (PST) Message-ID: Date: Tue, 28 Nov 2006 11:21:00 -0000 From: "Rob Quill" To: "Jim Blandy" Subject: Re: Variable values before initialisaton Cc: gdb@sourceware.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20061123195521.GA18110@nevyn.them.org> <20061124151537.GA12695@nevyn.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-11/txt/msg00192.txt.bz2 On 27/11/06, Jim Blandy wrote: > > Daniel Jacobowitz writes: > > On Fri, Nov 24, 2006 at 09:52:52AM +0300, Vladimir Prus wrote: > >> Can you clarify? Certainly, each constructor invocation produces a finite > >> number of processor instruction. You can identify the "last" instruction of > >> those, and hack gcc to produce file last_instructions_of_ctors.txt and make > >> gdb read such file and do the right thing. > > > > You can have: > > > > - Initialize part A of structure > > - Read part A of structure > > - Initialize rest of structure > > > > You don't want GDB to be unable to display the structure at that read, > > do you? So you need to know which bits of it are initialized and which > > aren't. And, in some cases, you want to be able to debug a structure > > pointer after "new" returns some storage but before the constructor is > > invoked. > > > > I suppose this is doable though: a very interesting project for someone > > interested in learning about debug info formats and generation would be > > to annotate initializedness somehow. The compiler does know. But it > > wouldn't be easy. > > I think this is a bit afield from Rob's original question. In the > code he posted: > > int i = 0; > int j = 2; > int k = 3; > > the issue isn't initialization. Rather it's that the scope of k > doesn't include the declarations of i and j, but GCC collapses all > these declarations into one block, so GDB thinks k's scope does > include the first two lines. If GCC produced DW_AT_start_scope > attributes (p. 61, #11 in DWARF 3), and GDB understood them, then this > would work. > Interesting. Is it that GCC doesn't implement it, or that GDB doesn't understand it, or both? How difficult to you think it would be to implement, because I think it would be quite good to have it right. Thanks, Rob