From patchwork Mon May 20 17:54:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Indu Bhagat X-Patchwork-Id: 1102285 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-501243-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="H0XUOPJ5"; dkim=pass (2048-bit key; unprotected) header.d=oracle.com header.i=@oracle.com header.b="ZHYRazza"; 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 45765r6vyhz9sDn for ; Tue, 21 May 2019 03:56:32 +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=ysYrP9KcqmsTX+EnryR3EPjZYp+G3YmvwIXhIIDX/mZpxxS91njIJ /+0Yrspyq0Yla3+aTjdgOuVrkEvnXasbSqGZN030oSWM1RA/Gi0nIsDVl7YIx0xE cPCjuTzmfXVhJggvG+QivZwjZHGK7L4NQE2F2rIjXrIHmOdYm02a2k= 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=7H/Z3IIj0j5Q4rGBrK5ZAT5kVwQ=; b=H0XUOPJ58epuCjZAjokMCnx0PWi5 l6m8aAi3CqiyVkEBduToJd2xd4TLhW2iCpCctrPDxc2bZ0vI+bUXica84Vi8MzFr /iIt3cm+/il5StzIsFnvQ5Mk/lHVDoh1PwIR1AIKVLXpXzSplindTlpl2xRYRDCp pUjO9uDkyJ+LvIs= Received: (qmail 2562 invoked by alias); 20 May 2019 17:56:24 -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 2366 invoked by uid 89); 20 May 2019 17:56:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.9 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=Request X-HELO: aserp2130.oracle.com Received: from aserp2130.oracle.com (HELO aserp2130.oracle.com) (141.146.126.79) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 20 May 2019 17:56:22 +0000 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.27/8.16.0.27) with SMTP id x4KHiYvq092026 for ; Mon, 20 May 2019 17:56:20 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=Z4TC4+Rdcf2hKibKBvOcWcPHIhK1JGHkuBGu94CA4Sg=; b=ZHYRazzatGSumbesQpnsi8sSmpaGttadHlk+xoLMPv902PceLsmoEXqWggUf7qFj1ThT p0pyLzZLnoT5iMP2HdbMXgtgr3qWiyh+NEiiEH5tCkBT4aZT2bEjYCqBiQWr6Bj4aFjl s84yvkKYegFzACNVvYO5BMZGGwKzDq6aFzapMMAdyKOky6gzvl/p1wLHPZgEVfALt6SM oye1p+MnlPiacRanO5OyOFCx16+ViBkx9YQIjtnLfQS/6MXKf9HcZArxDltTU93P/pEx SQMCG9Cw94IAAiYFFA6O4ZjBisotQFm3xlrxP0pBrkhVPBIp+npLa2K0mcS90df7X2N0 RA== Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2130.oracle.com with ESMTP id 2sj7jdgtpk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 20 May 2019 17:56:20 +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 x4KHrTfw189544 for ; Mon, 20 May 2019 17:54:20 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3030.oracle.com with ESMTP id 2sks1xr2mn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 20 May 2019 17:54:20 +0000 Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id x4KHsI73014746 for ; Mon, 20 May 2019 17:54:19 GMT Received: from ibhagatpc.us.oracle.com (/10.65.131.217) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 20 May 2019 17:54:18 +0000 From: Indu Bhagat To: gcc-patches@gcc.gnu.org Subject: [PATCH,RFC 2/3] Add CTF command line options : -gtLEVEL Date: Mon, 20 May 2019 10:54:14 -0700 Message-Id: <1558374855-19140-3-git-send-email-indu.bhagat@oracle.com> In-Reply-To: <1558374855-19140-1-git-send-email-indu.bhagat@oracle.com> References: <1558374855-19140-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 (set_ctf_debug_level): New Function. (common_handle_option): 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 d342c4f..2b5cfb8 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 5e3e887..2ed39c0 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -373,6 +373,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 @@ -7766,6 +7767,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 879ab17..dfd646b 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); @@ -2689,6 +2691,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); @@ -3011,6 +3017,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 ().) */