From patchwork Wed Jun 12 18:00:09 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1114738 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-502849-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="fF41Xv/m"; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="wLXCawSd"; 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 45PDsm3q98z9s9y for ; Thu, 13 Jun 2019 03:50:04 +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=W8H/fPYzSF/3IE1aKWaHRV7+7PIVR/pk5uyKaaj7anhepmizk5tDq FGfm3fWJgh0Y+OshqsQ78+YrNkUZkZpiOolaEBS8rdBLZeWuwDAdTWGQDYYtg2qS bNJOZHuiFxdkE3krGiIXVOoq+VEWdyNj+sBBzsvxgOety0FmmnS7r0= 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=PUeaE1g1uQ9S46oakzWQbZ++rGo=; b=fF41Xv/mRX7+eTihjAKlmVOHl6Pi 9GWaZIN7edUGj+jy8a5GKNKUb1n6XK4xDBTwEwdf5nDyD/VEaxp1lVc7+IMXTaWZ pOu+/TV71+hZqOGFGI4v+Xxr6+jgNQB/3W1H6gsT/BSStBvP97grVUGdzcwHPgMK x3EcUduxgbFC0Js= Received: (qmail 81740 invoked by alias); 12 Jun 2019 17:49:49 -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 81664 invoked by uid 89); 12 Jun 2019 17:49:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.9 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=Request, sk:DW_AT_c, sk:dw_at_c, stabs X-HELO: userp2130.oracle.com Received: from userp2130.oracle.com (HELO userp2130.oracle.com) (156.151.31.86) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 12 Jun 2019 17:49:46 +0000 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CHn6Wm039430 for ; Wed, 12 Jun 2019 17:49:44 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=tccuss6WJ20u6hEDvPe/W31r7czVwy4jpp4SIXxMo/k=; b=wLXCawSddUKa+VrnLy2JIVol/zcO55Dtyp+d32+zapbS+sCCmzxZhaNlFB92WnM/xAkE C4+/nYkcO4eeJODyjzxZCxo5xaMulDaXYF0ZI5TRPhF5+KTHdWAYduVVKCG4gAzbuXFN ZWeUgYVqQkcPjHO8khZLumGb6dnv7OgeEym9GLJfZHG/nF2G/pp5YbAXunb1WCV+uD72 SmaVXMfyZf5/5V1mIug8r8tvSXDwVPCp2rVLK+haFbNvDeDxJQNGLhqp5DrEm0Vsh0z2 xl0OJH/1Ic671ll1Ue/t9T/VL1c4/z4+fSLLxWO0Om79TNeW4S3GrBXaWmHGRxaZ6UpZ gQ== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by userp2130.oracle.com with ESMTP id 2t04etw527-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 12 Jun 2019 17:49:44 +0000 Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x5CHmutP043056 for ; Wed, 12 Jun 2019 17:49:43 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserp3030.oracle.com with ESMTP id 2t04j028ht-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 12 Jun 2019 17:49:43 +0000 Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x5CHngZI003484 for ; Wed, 12 Jun 2019 17:49:42 GMT Received: from ibhagatpc.us.oracle.com (/10.159.142.15) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 12 Jun 2019 10:49:41 -0700 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Subject: [PATCH,RFC,V2 2/3] Add CTF command line options : -gtLEVEL Date: Wed, 12 Jun 2019 11:00:09 -0700 Message-Id: <1560362410-27014-3-git-send-email-indu.bhagat@oracle.com> In-Reply-To: <1560362410-27014-1-git-send-email-indu.bhagat@oracle.com> References: <1560362410-27014-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. [Changes from V1] None 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 e140416..499f27c 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 @@ -2995,6 +3000,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 1520b2c..babf037 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 @@ -7784,6 +7785,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 64f94ac..a471a76 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); @@ -2683,6 +2685,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); @@ -3005,6 +3011,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 ().) */