From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14546 invoked by alias); 27 Dec 2011 12:45:48 -0000 Received: (qmail 14537 invoked by uid 22791); 27 Dec 2011 12:45:46 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 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; Tue, 27 Dec 2011 12:45:34 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E08842BB1CF for ; Tue, 27 Dec 2011 07:45:32 -0500 (EST) 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 oeYDrBKURU6k for ; Tue, 27 Dec 2011 07:45:32 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 609FA2BB1CC for ; Tue, 27 Dec 2011 07:45:32 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 9CA34145615; Tue, 27 Dec 2011 04:45:21 -0800 (PST) Date: Tue, 27 Dec 2011 12:45:00 -0000 From: Joel Brobecker To: gdb@sourceware.org Subject: GDB: varobj support for Ada objects #999 Message-ID: <20111227124521.GQ2632@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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: 2011-12/txt/msg00049.txt.bz2 This ticket is to track the overall work need to add support for Ada objects in the varobj module (GDB/MI variable objects). Currently, Ada varobj is implemented as a simple wrapper of C varobj. The initial plan was to simply implement features piecemeal, while falling back on C varobj for standard or unimplemented constructs. Unfortunately, I cannot make this work. This is mostly because the C varobj callbacks implementation needs access to the varobj as well as the varobj's value. One situation where this isn't going to work for Ada is the case where the varobj is an aggregate with one if its fields being a wrapper (this happens when the field encodes the variant section of a variant record). For instance, consider the following variant record: type Variant (Disc : Boolean := True) is record A : Integer; case Disc is when True => Yes : Boolean; No : Boolean; when False => D : Integer; end case; end record; After evalution, a variable of this type could look like (C-like syntax used on purpose to be closer to machine representation, including the casing used for the field names): struct variant { boolean disc; integer a; struct { boolean yes; boolean no; } S; } In this case, varobj should be told that this struct has 4 children (fields), not 3. In other words, the Ada varobj callbacks should unwrap field "S" on the fly. Similary, when varobj asks for the value of field #3 (boolean no), it is equivalent to saying we want field #0 of field "S". Since field #0 could itself be a complex type, including a wrapper, what we want to do in this situation is recurse. But as soon as we get field #0, we end up with a new value, which does not have an associated varobj. And as a result, we no longer have enough to call the C varobj routines. We should be able to get everything working purely with values. That's the good news. But the bad news is that we cannot fall back on the C varobj callbacks, and must implement everything from scratch. It also means that I cannot commit to our wavefront GDB until I get results at least as "good" as they are now. Hence this umbrella ticket. Individual tickets for each new testcase should be created nonetheless. I think we are going to need a lot of them. Assigned to me, priority P. Deadline: March 1st, 2012. -- Joel