From patchwork Thu Jul 18 00:07:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1133469 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-505239-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="ay6OeEdr"; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="q/UTnWjI"; 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 45pvMX279bz9sDQ for ; Thu, 18 Jul 2019 09:57:28 +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=H7pDv5qoiWuVsR62yzvLBrLkoBvgF53WuSgThx8trS2asc7JU32cW zovQaRaN/ZEJbt46Sv65JTavF9ogrJnxwgXPV3T5RrpwevP/sISInlfJljsPFRh6 6khvVdA4d/9qphI6I+0RIv7nJhObd2Eths4w+vfTixvIhapyiGIoXw= 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=EFVrBWxyXgN00fSmHe/5jwc9xtc=; b=ay6OeEdrTt8iD/Mvc3UBx92g1Dg6 K2JSQ8bj8ggjhuxQY69bEJBKfLToGkYNLfL/hptyVqfVJm660OL8O6+S6p+w0h0K B1YeDqeFlAHI93iYbl/4v1hu0ZE6PlwY8IMp8uQB9tbRVPL4qZl5L6340Y87ek4m D2ntt1Pe95xn6OE= Received: (qmail 125092 invoked by alias); 17 Jul 2019 23:57:08 -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 125041 invoked by uid 89); 17 Jul 2019 23:57:08 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS, SPF_PASS, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 spammy= 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, 17 Jul 2019 23:57:06 +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 x6HNs9jP153118 for ; Wed, 17 Jul 2019 23:57:03 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=fIgmXijyndVOnxiLLxwlDlEleHyUgJ1THoRJ2W2ktKY=; b=q/UTnWjInYr4jKmpSg02gFr0V8oRjQJrH1p5Te0dGEggFx+aveJGKcxaiuxEXCC6XmYp HKCcbLprXFUVubYaDUDARw0AF2Uas1f897CrZ56bHpuLgcZGpC2zdaR6cKX+tHD+j+T3 SxH7u9IB8uCKzl6Pcw2RD/gxary9M/p6Aed+i5w94AOId9R32cYpOVadUVRrNI6KH/lF lL6C2PzDj1uv/VY3kZ/JG4Zvfl0sLkwGGl0pl1aGOu9RcIjOdogeahTlIkvp1kuymJA3 15DDTtmWo0+zES29b6UXk5MyTjyT3DNnnGE+NbGOSWewSBwVXEg8ASamall9odsUdzYh Qw== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2130.oracle.com with ESMTP id 2tq6qtww4w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 17 Jul 2019 23:57:03 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x6HNqaUV156875 for ; Wed, 17 Jul 2019 23:57:03 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2tsmccprrj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Wed, 17 Jul 2019 23:57:03 +0000 Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id x6HNv2DC006816 for ; Wed, 17 Jul 2019 23:57:02 GMT Received: from ibhagatpc.us.oracle.com (/10.159.237.182) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 17 Jul 2019 23:57:02 +0000 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Subject: [PATCH,RFC,V4 2/5] Add CTF command line options : -gtLEVEL Date: Wed, 17 Jul 2019 17:07:57 -0700 Message-Id: <1563408480-4665-3-git-send-email-indu.bhagat@oracle.com> In-Reply-To: <1563408480-4665-1-git-send-email-indu.bhagat@oracle.com> References: <1563408480-4665-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 b998b25..cfa7d5c 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 @@ -3007,6 +3012,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 758aef3..70ab5b4 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -375,6 +375,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 @@ -7812,6 +7813,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 46a19a2..3b617c8 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); @@ -2686,6 +2688,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); @@ -3008,6 +3014,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 ().) */