public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Indu Bhagat <indu.bhagat@oracle.com>
To: gcc-patches@gcc.gnu.org, richard.guenther@gmail.com
Subject: [PATCH,RFC,V3 2/5] Add CTF command line options : -gtLEVEL
Date: Thu, 27 Jun 2019 06:37:00 -0000	[thread overview]
Message-ID: <1561617445-9328-3-git-send-email-indu.bhagat@oracle.com> (raw)
In-Reply-To: <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=<value>.
 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 ().)  */
-- 
1.8.3.1

  parent reply	other threads:[~2019-06-27  6:37 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27  6:37 [PATCH,RFC,V3 0/5] Support for CTF in GCC Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 3/5] Setup for CTF generation and emission Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 5/5] Update CTF testsuite Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 1/5] Add new function lang_GNU_GIMPLE Indu Bhagat
2019-06-27  6:37 ` [PATCH,RFC,V3 4/5] CTF generation for a single compilation unit Indu Bhagat
2019-06-27  6:37 ` Indu Bhagat [this message]
2019-07-02 17:43 ` [PATCH,RFC,V3 0/5] Support for CTF in GCC Indu Bhagat
2019-07-03  3:18   ` Jeff Law
2019-07-03 12:39     ` Richard Biener
2019-07-04  1:49       ` Indu Bhagat
2019-07-04 10:47         ` Richard Biener
2019-07-04 22:44           ` Indu Bhagat
2019-07-05 11:25             ` Richard Biener
2019-07-05 18:28               ` Nix
2019-07-05 19:37                 ` Jakub Jelinek
2019-07-08 14:16                   ` Nix
2019-07-09 23:25                 ` Mike Stump
2019-07-11 12:25                   ` Nix
2019-07-09 23:46                 ` Segher Boessenkool
2019-07-10  0:50                   ` Jeff Law
2019-07-11 12:59                   ` Nix
2019-07-11 16:54                     ` Segher Boessenkool
2019-07-09 17:32           ` Indu Bhagat
2019-07-04  0:36     ` Indu Bhagat

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1561617445-9328-3-git-send-email-indu.bhagat@oracle.com \
    --to=indu.bhagat@oracle.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).