On Dec  7, 2017, Jeff Law <l...@redhat.com> wrote:

> On 11/09/2017 07:34 PM, Alexandre Oliva wrote:
>> Introduce a command line option to enable statement frontiers, enabled
>> by default in optimized builds with DWARF2+ debug information.
> OK once all prereqs are ack'd.

Thanks, here's what's installed, FTR:

>From aa2fd8850c18861c8e3811b9174b0b1667111783 Mon Sep 17 00:00:00 2001
From: aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Tue, 12 Dec 2017 02:16:31 +0000
Subject: [PATCH 6/7] [SFN] Introduce -gstatement-frontiers option, enable
 debug markers

Introduce a command line option to enable statement frontiers, enabled
by default in optimized builds with DWARF2+ debug information.

This patch depends on an earlier patch that completed the
infrastructure for debug markers, and on another patch that turns -g
into a negatable option prefix.

for  gcc/ChangeLog

        * common.opt (gstatement-frontiers): New, setting
        debug_nonbind_markers_p.
        * rtl.h (MAY_HAVE_DEBUG_MARKER_INSNS): Activate.
        * toplev.c (process_options): Autodetect value for debug statement
        frontiers option.
        * tree.h (MAY_HAVE_DEBUG_MARKER_STMTS): Activate.
        * doc/invoke.texi (gstatement-frontiers, gno-statement-frontiers): New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@255569 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/ChangeLog       |  8 ++++++++
 gcc/common.opt      |  4 ++++
 gcc/doc/invoke.texi | 12 ++++++++++++
 gcc/rtl.h           |  2 +-
 gcc/toplev.c        |  4 ++++
 gcc/tree.h          |  2 +-
 6 files changed, 30 insertions(+), 2 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 01bd2b9f49ad..a53e7b8173f5 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,13 @@
 2017-12-12  Alexandre Oliva <aol...@redhat.com>
 
+       * common.opt (gstatement-frontiers): New, setting
+       debug_nonbind_markers_p.
+       * rtl.h (MAY_HAVE_DEBUG_MARKER_INSNS): Activate.
+       * toplev.c (process_options): Autodetect value for debug statement
+       frontiers option.
+       * tree.h (MAY_HAVE_DEBUG_MARKER_STMTS): Activate.
+       * doc/invoke.texi (gstatement-frontiers, gno-statement-frontiers): New.
+
        * cfgexpand.c (expand_gimple_basic_block): Handle begin stmt
        markers.  Integrate source bind into debug stmt expand loop.
        (pass_expand::execute): Check debug marker limit.  Avoid deep
diff --git a/gcc/common.opt b/gcc/common.opt
index 57b3cd7304ab..d80ae5b7f39b 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2936,6 +2936,10 @@ gstabs+
 Common Driver JoinedOrMissing Negative(gvms)
 Generate debug information in extended STABS format.
 
+gstatement-frontiers
+Common Driver Var(debug_nonbind_markers_p) Init(2)
+Emit progressive recommended breakpoint locations.
+
 gstrict-dwarf
 Common Driver Report Var(dwarf_strict) Init(0)
 Don't emit DWARF additions beyond selected version.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 189b3e438fff..6402a5ae1734 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -346,6 +346,7 @@ Objective-C and Objective-C++ Dialects}.
 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
 -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
 -gcolumn-info  -gno-column-info @gol
+-gstatement-frontiers  -gno-statement-frontiers @gol
 -gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
 -fno-eliminate-unused-debug-types @gol
@@ -7146,6 +7147,17 @@ Emit location column information into DWARF debugging 
information, rather
 than just file and line.
 This option is enabled by default.
 
+@item -gstatement-frontiers
+@item -gno-statement-frontiers
+@opindex gstatement-frontiers
+@opindex gno-statement-frontiers
+This option causes GCC to create markers in the internal representation
+at the beginning of statements, and to keep them roughly in place
+throughout compilation, using them to guide the output of @code{is_stmt}
+markers in the line number table.  This is enabled by default when
+compiling with optimization (@option{-Os}, @option{-O}, @option{-O2},
+@dots{}), and outputting DWARF 2 debug information at the normal level.
+
 @item -gz@r{[}=@var{type}@r{]}
 @opindex gz
 Produce compressed debug sections in DWARF format, if that is supported.
diff --git a/gcc/rtl.h b/gcc/rtl.h
index 4de167d982cf..3ef687e5a371 100644
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -816,7 +816,7 @@ struct GTY(()) rtvec_def {
 #define NONDEBUG_INSN_P(X) (INSN_P (X) && !DEBUG_INSN_P (X))
 
 /* Nonzero if DEBUG_MARKER_INSN_P may possibly hold.  */
-#define MAY_HAVE_DEBUG_MARKER_INSNS 0 /* debug_nonbind_markers_p */
+#define MAY_HAVE_DEBUG_MARKER_INSNS debug_nonbind_markers_p
 /* Nonzero if DEBUG_BIND_INSN_P may possibly hold.  */
 #define MAY_HAVE_DEBUG_BIND_INSNS flag_var_tracking_assignments
 /* Nonzero if DEBUG_INSN_P may possibly hold.  */
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 2f154960a170..b6e038d2f89d 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1536,6 +1536,10 @@ process_options (void)
     warning_at (UNKNOWN_LOCATION, 0,
                "var-tracking-assignments changes selective scheduling");
 
+  if (debug_nonbind_markers_p == AUTODETECT_VALUE)
+    debug_nonbind_markers_p = optimize && debug_info_level >= 
DINFO_LEVEL_NORMAL
+      && (write_symbols == DWARF2_DEBUG || write_symbols == 
VMS_AND_DWARF2_DEBUG);
+
   if (flag_tree_cselim == AUTODETECT_VALUE)
     {
       if (HAVE_conditional_move)
diff --git a/gcc/tree.h b/gcc/tree.h
index 892a8ba7f707..83af3bcaf55f 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1124,7 +1124,7 @@ extern void omp_clause_range_check_failed (const_tree, 
const char *, int,
   ((int)TREE_INT_CST_LOW (VL_EXP_CHECK (NODE)->exp.operands[0]))
 
 /* Nonzero if gimple_debug_nonbind_marker_p() may possibly hold.  */
-#define MAY_HAVE_DEBUG_MARKER_STMTS 0 /* debug_nonbind_markers_p */
+#define MAY_HAVE_DEBUG_MARKER_STMTS debug_nonbind_markers_p
 /* Nonzero if gimple_debug_bind_p() (and thus
    gimple_debug_source_bind_p()) may possibly hold.  */
 #define MAY_HAVE_DEBUG_BIND_STMTS flag_var_tracking_assignments
-- 
2.13.6



-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist|Red Hat Brasil GNU Toolchain Engineer

Reply via email to