From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 102538 invoked by alias); 25 Nov 2015 20:38:19 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 102520 invoked by uid 89); 25 Nov 2015 20:38:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.3 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Wed, 25 Nov 2015 20:38:17 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 7C594352B791; Wed, 25 Nov 2015 21:38:14 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZEcErh6N4Mdi; Wed, 25 Nov 2015 21:38:14 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 3F6F3352B78A; Wed, 25 Nov 2015 21:38:14 +0100 (CET) From: Eric Botcazou To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Pierre-Marie de Rodat Subject: Re: [PATCH, PING*4] PR debug/53927: fix value for DW_AT_static_link Date: Wed, 25 Nov 2015 21:08:00 -0000 Message-ID: <11778470.G44ae9R4Oo@polaris> User-Agent: KMail/4.14.9 (Linux/3.16.7-29-desktop; KDE/4.14.9; x86_64; ; ) In-Reply-To: <5655F5E5.1090300@redhat.com> References: <55ACA5C9.4090608@adacore.com> <5654916D.5070309@adacore.com> <5655F5E5.1090300@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-SW-Source: 2015-11/txt/msg03149.txt.bz2 > The DWARF change is OK if the tree-nested.c changes make sense to Eric. As discussed in the audit trail of the PR, I'd rather have avoided the additional indirection, but the DWARF requirement seems to force it if we base the computation on the static chain and I don't see another approach. A few comments: + int save_warn_padded; + tree *adjust, *field_decl_p; + char *name; + tree fb_decl, fb_ref, fb_tmp; + gcall *fb_gimple; + gimple_stmt_iterator gsi; We try to declare variables only at the first use point now I think. + /* Debugging information needs to compute the frame base address of the + nestee frame out of the static chain from the nested frame. "parent frame" + The static chain is the address of the FRAME record, so one could + imagine it would be possible to compute the frame base address just + adding a constant offset to this address. Unfortunately, this is not + possible: if the FRAME object has alignment constraints that are + stronger than the stack, then the offset between the frame base and + the FRAME object will be dynamic. + + What we do instead is to append a field to the FRAME object that holds + the frame base address: then debug. info. just has to fetch this + field. */ No useless period: "debug info" + /* Debugging information will refer to the CFA as the frame base + address: we will do the same here. */ + const tree frame_addr_fndecl + = builtin_decl_explicit (BUILT_IN_DWARF_CFA); + + /* Create a field in the FRAME record to hold the frame base address for + this stack frame. Since it will be used only by the debugger (through + the debugging information), put it at the end of the record not to + shift all other offsets. */ "(through the debugging information)" sounds superfluous. "in order not to..." + fb_decl = make_node (FIELD_DECL); + name = concat ("FRAME_BASE.", + IDENTIFIER_POINTER (DECL_NAME (root->context)), + NULL); + DECL_NAME (fb_decl) = get_identifier (name); + free (name); Let's avoid this concat/free business and use a simpler name. + TREE_TYPE (fb_decl) = ptr_type_node; + TREE_ADDRESSABLE (fb_decl) = 1; + DECL_CONTEXT (fb_decl) = root->frame_type; + field_decl_p = &TYPE_FIELDS (root->frame_type); + while (*field_decl_p != NULL_TREE) + field_decl_p = &DECL_CHAIN (*field_decl_p); + *field_decl_p = fb_decl; TYPE_FIELDS (root->frame_type) = chainon (TYPE_FIELDS (root->frame_type), fb_decl); -- Eric Botcazou