From patchwork Sat Mar 16 18:36:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jason Merrill X-Patchwork-Id: 228236 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 0B4412C00AB for ; Sun, 17 Mar 2013 05:37:09 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1364063831; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=NbUOgMt xWL0J7cBxydztKsCaqSI=; b=nveiEaouqLRikZ71wEi0M1SFbmKvLO4sdA+kP/w s+741D2FwS8InarpklzoGAut0NRZeRIj9h0E7bYFA8pnNg3Z7HqVLCH3ScNFpZRN L5vN/VCEUwb6vuv94SOfhxha6GAYby2lNRuj4SQI1tvJGhcxCvdBoBsv2BWONZYs Wym0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=GWdu9eQlkFnbFTcwiM1dundXf4SUZxLPaEiYRMaA6r+GPVH20DLUuY6a3AgEaB IuB9YlY7QskjAwheH7Rk0III0/95K2ShAaaqXWFJMM7x+/4sksK5zrLkI85LCXLM +KjJ1575J4wUJO9JelASQp43mbjTvjFTZprhtOBpLUtc0=; Received: (qmail 21651 invoked by alias); 16 Mar 2013 18:36:59 -0000 Received: (qmail 21465 invoked by uid 22791); 16 Mar 2013 18:36:56 -0000 X-SWARE-Spam-Status: No, hits=-7.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Mar 2013 18:36:47 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r2GIalS1003895 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 16 Mar 2013 14:36:47 -0400 Received: from [10.3.113.72] (ovpn-113-72.phx2.redhat.com [10.3.113.72]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r2GIajQJ025918; Sat, 16 Mar 2013 14:36:46 -0400 Message-ID: <5144BBBD.9090109@redhat.com> Date: Sat, 16 Mar 2013 14:36:45 -0400 From: Jason Merrill User-Agent: Mozilla/5.0 (X11; Linux i686; rv:21.0) Gecko/20100101 Thunderbird/21.0a2 MIME-Version: 1.0 To: gcc-patches List CC: Cary Coutant Subject: DWARF2 patch for debug/49090 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The GDB team asked for some indication that a DW_TAG_template_*_parameter node represents a default template argument rather than one supplied by the user; I think that using DW_AT_default_value as a flag makes sense here. Tested x86_64-pc-linux-gnu, applying to trunk. commit 2500158c694114e1f5a627c26e55d936de21905e Author: Jason Merrill Date: Fri Feb 1 14:47:14 2013 -0500 PR debug/49090 * dwarf2out.c (gen_generic_params_dies): Indicate default arguments with DW_AT_default_value. diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index d7faaac..51e5737 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10238,6 +10238,7 @@ gen_generic_params_dies (tree t) tree parms, args; int parms_num, i; dw_die_ref die = NULL; + int non_default; if (!t || (TYPE_P (t) && !COMPLETE_TYPE_P (t))) return; @@ -10257,9 +10258,14 @@ gen_generic_params_dies (tree t) parms_num = TREE_VEC_LENGTH (parms); args = lang_hooks.get_innermost_generic_args (t); + if (TREE_CHAIN (args) && TREE_CODE (TREE_CHAIN (args)) == INTEGER_CST) + non_default = int_cst_value (TREE_CHAIN (args)); + else + non_default = TREE_VEC_LENGTH (args); for (i = 0; i < parms_num; i++) { tree parm, arg, arg_pack_elems; + dw_die_ref parm_die; parm = TREE_VEC_ELT (parms, i); arg = TREE_VEC_ELT (args, i); @@ -10274,12 +10280,14 @@ gen_generic_params_dies (tree t) pack elements of ARG. Note that ARG would then be an argument pack. */ if (arg_pack_elems) - template_parameter_pack_die (TREE_VALUE (parm), - arg_pack_elems, - die); + parm_die = template_parameter_pack_die (TREE_VALUE (parm), + arg_pack_elems, + die); else - generic_parameter_die (TREE_VALUE (parm), arg, - true /* Emit DW_AT_name */, die); + parm_die = generic_parameter_die (TREE_VALUE (parm), arg, + true /* emit name */, die); + if (i >= non_default) + add_AT_flag (parm_die, DW_AT_default_value, 1); } } } diff --git a/gcc/langhooks.h b/gcc/langhooks.h index 4bc1bd5..80d4ef3 100644 --- a/gcc/langhooks.h +++ b/gcc/langhooks.h @@ -407,8 +407,10 @@ struct lang_hooks struct lang_hooks_for_lto lto; - /* Returns the generic parameters of an instantiation of - a generic type or decl, e.g. C++ template instantiation. */ + /* Returns a TREE_VEC of the generic parameters of an instantiation of + a generic type or decl, e.g. C++ template instantiation. If + TREE_CHAIN of the return value is set, it is an INTEGER_CST + indicating how many of the elements are non-default. */ tree (*get_innermost_generic_parms) (const_tree); /* Returns the TREE_VEC of arguments of an instantiation