From patchwork Thu Jun 27 06:37:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1123148 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-503842-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=oracle.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="jrNstmu7"; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="DgxGYo9C"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45Z9FL4JvTz9s4Y for ; Thu, 27 Jun 2019 16:37:58 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; q=dns; s= default; b=TvUu8N4a6CI8lcDOzXPdxNy0UOUQmdXrcLx3EEnFJKQfu2iVBVi7N Vj0dh+YDTtMyWGDsOZ3blJDuIqspZtIsMcSsGXt4fpO7BbOmFJvhYIzA3zJse5cR nzg8xuJpZ2dakTbF10LZLH4N7ErwfKKryedJXsvUdJZMPJdx+ZBIic= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:in-reply-to:references; s=default; bh=//RvOCHNwPx0ZxIjAQoTb3pT70w=; b=jrNstmu7N0yQOPST7/aoHRxSDOA7 eyv9AzIJguM4y05zj5OFKIF2fy2XY+5dlmcCp+yubGpRkKpTkIgOLUCy947KY73N BbvRj46c8tozslTDbPImFJ520aQBSU8PsyKr5gNahhTFaZn+gvfx40OVXBIFr3ms qeVV5HTKipcrmK0= Received: (qmail 107984 invoked by alias); 27 Jun 2019 06:37:38 -0000 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 Received: (qmail 107912 invoked by uid 89); 27 Jun 2019 06:37:38 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy=sk:dw_at_c, sk:DW_AT_c, arrange, H*r:8.14.4 X-HELO: userp2120.oracle.com Received: from userp2120.oracle.com (HELO userp2120.oracle.com) (156.151.31.85) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Jun 2019 06:37:36 +0000 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5R6XYoR027221; Thu, 27 Jun 2019 06:37:33 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : in-reply-to : references; s=corp-2018-07-02; bh=PaPoN/LABOYHZys14fr+OVodDDtTTA6UMaIRFS62D2I=; b=DgxGYo9Cr9yD6jPE6ZstBnUISrIWUUZQn6macQ9MdyUf6w9iW9oTYGSWS91GhvIf97gk /u28Ksnxe4RPZTePgJvoxTB/q/AShNaM2MiO8SIjra8uIt06RPCWrSBxcv/knVa1syl7 iq2sw0JbwNh5d8dMz3mze/lhSZJEOxa4o1xZHghicO7PXP8qA8hR1kZeaoY9hayTovcq bL2Lq/CBewAQg5x/i5eGxv+MTpmx+ezdHYj2Bn7y8ksR425M4fgGuHE4Pt1sKWCnV1OO YZCCAwA7NZm+dK43EqTR9w31ZFvKU5e2GvVxYDML3yLuxEunYhVnF4WQEB8Vhd1FjxSk zA== Received: from userp3030.oracle.com (userp3030.oracle.com [156.151.31.80]) by userp2120.oracle.com with ESMTP id 2t9cyqp81q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2019 06:37:32 +0000 Received: from pps.filterd (userp3030.oracle.com [127.0.0.1]) by userp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5R6Zu4P091045; Thu, 27 Jun 2019 06:37:32 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userp3030.oracle.com with ESMTP id 2t99f4u8u7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 27 Jun 2019 06:37:32 +0000 Received: from abhmp0012.oracle.com (abhmp0012.oracle.com [141.146.116.18]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x5R6bVSd006569; Thu, 27 Jun 2019 06:37:31 GMT Received: from ibhagatpc.us.oracle.com (/10.159.231.47) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 26 Jun 2019 23:37:31 -0700 From: Indu Bhagat To: gcc-patches@gcc.gnu.org, richard.guenther@gmail.com Subject: [PATCH,RFC,V3 2/5] Add CTF command line options : -gtLEVEL Date: Wed, 26 Jun 2019 23:37:22 -0700 Message-Id: <1561617445-9328-3-git-send-email-indu.bhagat@oracle.com> In-Reply-To: <1561617445-9328-1-git-send-email-indu.bhagat@oracle.com> References: <1561617445-9328-1-git-send-email-indu.bhagat@oracle.com> -gtLEVEL is used to request CTF debug information and also to specify how much CTF debug information. gcc/ChangeLog : * common.opt: Add CTF debug info options. * doc/invoke.texi: Document the CTF debug info options. * flag-types.h (enum ctf_debug_info_levels): New enum. * opts.c (common_handle_option): New Function. (set_ctf_debug_level): Handle the new CTF debug info options. --- gcc/ChangeLog | 8 ++++++++ gcc/common.opt | 9 +++++++++ gcc/doc/invoke.texi | 16 ++++++++++++++++ gcc/flag-types.h | 13 +++++++++++++ gcc/opts.c | 26 ++++++++++++++++++++++++++ 5 files changed, 72 insertions(+) diff --git a/gcc/common.opt b/gcc/common.opt index a1544d0..52cd7b2 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -125,6 +125,11 @@ enum debug_info_levels debug_info_level = DINFO_LEVEL_NONE Variable bool use_gnu_debug_info_extensions +; Level of CTF debugging information we are producing. See flag-types.h +; for the definitions of the different possible levels. +Variable +enum ctf_debug_info_levels ctf_debug_info_level = CTFINFO_LEVEL_NONE + ; Original value of maximum field alignment in bytes, specified via ; -fpack-struct=. Variable @@ -2999,6 +3004,10 @@ gcolumn-info Common Driver Var(debug_column_info,1) Init(1) Record DW_AT_decl_column and DW_AT_call_column in DWARF. +gt +Common Driver RejectNegative JoinedOrMissing +Generate CTF debug information at default level. + gdwarf Common Driver JoinedOrMissing Negative(gdwarf-) Generate debug information in default version of DWARF format. diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 03d2895..74d20db 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -374,6 +374,7 @@ Objective-C and Objective-C++ Dialects}. @item Debugging Options @xref{Debugging Options,,Options for Debugging Your Program}. @gccoptlist{-g -g@var{level} -gdwarf -gdwarf-@var{version} @gol +-gt -gt@var{level} @gol -ggdb -grecord-gcc-switches -gno-record-gcc-switches @gol -gstabs -gstabs+ -gstrict-dwarf -gno-strict-dwarf @gol -gas-loc-support -gno-as-loc-support @gol @@ -7798,6 +7799,21 @@ other DWARF-related options such as @option{-fno-dwarf2-cfi-asm}) retain a reference to DWARF Version 2 in their names, but apply to all currently-supported versions of DWARF. +@item -gt +@itemx -gt@var{level} +@opindex gt +Request CTF debug information and use level to specify how much CTF debug +information should be produced. If -gt is specified without a value for level, +the default level of CTF debug information is 2. + +Level 0 produces no CTF debug information at all. Thus, -gt0 negates -gt. + +Level 1 produces CTF information for tracebacks only. This includes callsite +information, but does not include type information. + +Level 2 produces type information for entities (functions, data objects etc.) +at file-scope or global-scope only. + @item -gstabs @opindex gstabs Produce debugging information in stabs format (if that is supported), diff --git a/gcc/flag-types.h b/gcc/flag-types.h index a210328..61a1432 100644 --- a/gcc/flag-types.h +++ b/gcc/flag-types.h @@ -105,6 +105,19 @@ enum dwarf_gnat_encodings Emit GNAT encodings for the rest. */ }; +/* CTF debug info levels. + CTF debug info levels are untied with DWARF debug info levels because CTF + may co-exist with DWARF. */ +enum ctf_debug_info_levels +{ + CTFINFO_LEVEL_NONE = 0, /* Write no CTF debug info. */ + CTFINFO_LEVEL_TERSE = 1, /* Write CTF information to support tracebacks + only. Not Implemented. */ + CTFINFO_LEVEL_NORMAL = 2 /* Write CTF type information for all entities + (functions, data objects, variables etc.) + at file-scope or global-scope only. */ +}; + /* Enumerate Objective-c instance variable visibility settings. */ enum ivar_visibility diff --git a/gcc/opts.c b/gcc/opts.c index b38bfb1..03346ec 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -195,6 +195,8 @@ static void set_debug_level (enum debug_info_type type, int extended, const char *arg, struct gcc_options *opts, struct gcc_options *opts_set, location_t loc); +static void set_ctf_debug_level (const char *arg, + struct gcc_options *opts, location_t loc); static void set_fast_math_flags (struct gcc_options *opts, int set); static void decode_d_option (const char *arg, struct gcc_options *opts, location_t loc, diagnostic_context *dc); @@ -2684,6 +2686,10 @@ common_handle_option (struct gcc_options *opts, opts->x_flag_stack_usage_info = value != 0; break; + case OPT_gt: + set_ctf_debug_level (arg, opts, loc); + break; + case OPT_g: set_debug_level (NO_DEBUG, DEFAULT_GDB_EXTENSIONS, arg, opts, opts_set, loc); @@ -3006,6 +3012,26 @@ set_debug_level (enum debug_info_type type, int extended, const char *arg, } } +/* Handle a debug output -gt switch for options OPTS. */ +static void +set_ctf_debug_level (const char *arg, + struct gcc_options *opts, location_t loc) +{ + /* CTF debug flag without a level defaults to level 2. */ + if (*arg == '\0') + opts->x_ctf_debug_info_level = CTFINFO_LEVEL_NORMAL; + else + { + int argval = integral_argument (arg); + if (argval == -1) + error_at (loc, "unrecognized ctf debug output level %qs", arg); + else if (argval > CTFINFO_LEVEL_NORMAL) + error_at (loc, "ctf debug output level %qs is too high", arg); + else + opts->x_ctf_debug_info_level = (enum ctf_debug_info_levels) argval; + } +} + /* Arrange to dump core on error for diagnostic context DC. (The regular error message is still printed first, except in the case of abort ().) */