From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 80768 invoked by alias); 2 Nov 2016 15:44:26 -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 80602 invoked by uid 89); 2 Nov 2016 15:44:22 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=sk:build_o, gen_type_die, team 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 ESMTP; Wed, 02 Nov 2016 15:44:12 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BFC9C80E4A; Wed, 2 Nov 2016 15:44:10 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-204-19.brq.redhat.com [10.40.204.19]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uA2Fi85A006607 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 2 Nov 2016 11:44:10 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id uA2Fi7xQ028958; Wed, 2 Nov 2016 16:44:07 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id uA2Fi50N028957; Wed, 2 Nov 2016 16:44:05 +0100 Date: Wed, 02 Nov 2016 15:44:00 -0000 From: Jakub Jelinek To: Jason Merrill Cc: Alexandre Oliva , Keith Seitz , Jan Kratochvil , Pierre-Marie de Rodat , gcc-patches List Subject: Re: [PATCH] DW_TAG_ptr_to_member_type for PMF and DW_AT_{,rvalue_}reference for those Message-ID: <20161102154405.GX3541@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20161102143100.GU3541@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-IsSubscribed: yes X-SW-Source: 2016-11/txt/msg00202.txt.bz2 On Wed, Nov 02, 2016 at 11:31:25AM -0400, Jason Merrill wrote: > On Wed, Nov 2, 2016 at 10:31 AM, Jakub Jelinek wrote: > > It uses Alex' LANG_HOOKS_GET_PTRMEMFN_TYPE langhook. I've tried > > to think about https://gcc.gnu.org/ml/gcc-patches/2011-05/msg00227.html > > and we even have such a langhook now, modified_type_die > > uses lang_hooks.types.get_debug_type, but > > 1) it is just called in modified_type_die and not in > > gen_type_die_with_usage, that looks weird > > How much of a problem is that? modified_type_die calls gen_type_die, > does that not cover the cases needed here? If e.g. on the ref-3.C testcase from the patch I put breakpoint on both gen_ptr_to_mbr_type_die and modified_type_die (the latter only for type->base.code == RECORD_TYPE), then I see first: #0 gen_ptr_to_mbr_type_die (type=, context_die=>, class_type=, member_type=) at ../../gcc/dwarf2out.c:23128 #1 0x0000000000c3a7e5 in gen_type_die_with_usage (type=, context_die=>, usage=DINFO_USAGE_DIR_USE) at ../../gcc/dwarf2out.c:24428 #2 0x0000000000c3ab92 in gen_type_die (type=, context_die=>) at ../../gcc/dwarf2out.c:24491 #3 0x0000000000c3caed in gen_decl_die (decl=, origin=, ctx=0x0, context_die=>) at ../../gcc/dwarf2out.c:25117 #4 0x0000000000c3b13e in process_scope_var (stmt=, decl=, origin=, context_die=>) at ../../gcc/dwarf2out.c:24620 #5 0x0000000000c3b1bb in decls_for_scope (stmt=, context_die=>) at ../../gcc/dwarf2out.c:24645 and only afterwards: #0 modified_type_die (type=, cv_quals=0, reverse=false, context_die=>) at ../../gcc/dwarf2out.c:12328 #1 0x0000000000c2f03b in add_type_attribute (object_die=>, type=, cv_quals=0, reverse=false, context_die=>) at ../../gcc/dwarf2out.c:20346 #2 0x0000000000c354f4 in gen_variable_die (decl=, origin=, context_die=>) at ../../gcc/dwarf2out.c:22688 #3 0x0000000000c3cb8e in gen_decl_die (decl=, origin=, ctx=0x0, context_die=>) at ../../gcc/dwarf2out.c:25138 #4 0x0000000000c3b13e in process_scope_var (stmt=, decl=, origin=, context_die=>) at ../../gcc/dwarf2out.c:24620 #5 0x0000000000c3b1bb in decls_for_scope (stmt=, context_die=>) at ../../gcc/dwarf2out.c:24645 which means if gen_type_die or gen_type_die_with_usage doesn't use the langhook, then we'd emit a completely useless { __pfn; __delta } struct into debug info first, and then in modified_type_die used the langhook, get OFFSET_TYPE and probably create the DW_TAG_ptr_to_member_type. So I think we really need that. > > 2) it is used for something Ada-ish I really don't know how to test etc. > > to be able to find out if it is safe to call it in > > gen_type_die_with_usage too > > You could find an Ada test that uses the code and verify that the > output stays the same? I can try to find the patch that introduced it and if it contained any testcases. > > 3) most importantly, if the C++ version of this langhook would create > > OFFSET_TYPE on the fly, I don't know how to ensure effective sharing > > of DW_TAG_ptr_to_member_type nodes with the same DW_AT_type > > and DW_AT_containing_type; unless the C++ langhook adds some extra > > hash table that caches already created OFFSET_TYPEs or something similar, > > it would create a new OFFSET_TYPE each time it is called > > build_offset_type already uses a hash table. Ah, ok. > > Also, I really don't know how well does GDB (especially older releases) > > handle DW_TAG_ptr_to_member_type for PMF, so the patch wraps that currently > > with if (dwarf_version >= 5). Quick grep revealed that GDB has code to > > handle the __pfn/__delta fields. So, can I ask somebody from the GDB > > team to test this patch with that if (dwarf_version >= 5) replaced > > with if (1) and see if it works properly with current GDB as well as say > > 4-5 years old one (e.g. with -gdwarf-2 or -gdwarf-3)? If yes, we > > should emit it unconditionally. > > This all makes sense to me. > > > + if (dwarf_version >= 5) > > + { > > + tree class_type = lang_hooks.types.get_ptrmemfn_type (type, 0); > > + if (class_type != NULL_TREE) > > This can be > > if (dwarf_version >= 5) > if (tree class_type = lang_hooks.types.get_ptrmemfn_type (type, 0)) Ok. Jakub