common.opt (gno-column-info, [...]): New options.
authorJakub Jelinek <jakub@redhat.com>
Sat, 18 Feb 2017 16:10:43 +0000 (17:10 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 18 Feb 2017 16:10:43 +0000 (17:10 +0100)
* common.opt (gno-column-info, gcolumn-info): New options.
* dwarf2out.c (dwarf2_lineno_debug_hooks): Formatting fix.
(check_die): Also test for multiple DW_AT_decl_column attributes.
(add_src_coords_attributes, dwarf2out_imported_module_or_decl_1): Add
DW_AT_decl_column if requested.
(gen_subprogram_die): Compare and/or add also DW_AT_decl_column
if requested.
(gen_variable_die): Likewise.
(add_call_src_coords_attributes): Add DW_AT_call_column if requested.
* doc/invoke.texi (-gcolumn-info, -gno-column-info): Document.

From-SVN: r245563

gcc/ChangeLog
gcc/common.opt
gcc/doc/invoke.texi
gcc/dwarf2out.c

index 69db3df..3d4b523 100644 (file)
@@ -1,5 +1,16 @@
 2017-02-18  Jakub Jelinek  <jakub@redhat.com>
 
+       * common.opt (gno-column-info, gcolumn-info): New options.
+       * dwarf2out.c (dwarf2_lineno_debug_hooks): Formatting fix.
+       (check_die): Also test for multiple DW_AT_decl_column attributes.
+       (add_src_coords_attributes, dwarf2out_imported_module_or_decl_1): Add
+       DW_AT_decl_column if requested.
+       (gen_subprogram_die): Compare and/or add also DW_AT_decl_column
+       if requested.
+       (gen_variable_die): Likewise.
+       (add_call_src_coords_attributes): Add DW_AT_call_column if requested.
+       * doc/invoke.texi (-gcolumn-info, -gno-column-info): Document.
+
        PR target/79569
        * config/i386/i386.opt (m3dnowa): Replace Undocumented with Report.
        * common/config/i386/i386-common.c (OPTION_MASK_ISA_3DNOW_A_SET): Define.
index ad6baa3..6defe71 100644 (file)
@@ -2805,6 +2805,14 @@ gcoff
 Common Driver JoinedOrMissing Negative(gdwarf)
 Generate debug information in COFF format.
 
+gno-column-info
+Common Driver RejectNegative Var(debug_column_info,0) Init(0)
+Don't record DW_AT_decl_column and DW_AT_call_column in DWARF.
+
+gcolumn-info
+Common Driver RejectNegative Var(debug_column_info,1)
+Record DW_AT_decl_column and DW_AT_call_column in DWARF.
+
 gdwarf
 Common Driver JoinedOrMissing Negative(gdwarf-)
 Generate debug information in default version of DWARF format.
index 31d1095..c65086c 100644 (file)
@@ -338,6 +338,7 @@ Objective-C and Objective-C++ Dialects}.
 @gccoptlist{-g  -g@var{level}  -gcoff  -gdwarf  -gdwarf-@var{version} @gol
 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
 -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
+-gcolumn-info  -gno-column-info @gol
 -gvms  -gxcoff  -gxcoff+  -gz@r{[}=@var{type}@r{]} @gol
 -fdebug-prefix-map=@var{old}=@var{new}  -fdebug-types-section @gol
 -feliminate-dwarf2-dups  -fno-eliminate-unused-debug-types @gol
@@ -6816,6 +6817,14 @@ DWARF extensions from later standard versions is allowed.
 Allow using extensions of later DWARF standard version than selected with
 @option{-gdwarf-@var{version}}.
 
+@item -gcolumn-info
+@item -gno-column-info
+@opindex gcolumn-info
+@opindex gno-column-info
+Emit location column information into DWARF debugging information, rather
+than just file and line.
+This option is disabled by default.
+
 @item -gz@r{[}=@var{type}@r{]}
 @opindex gz
 Produce compressed debug sections in DWARF format, if that is supported.
index cfb00b8..f39c2aa 100644 (file)
@@ -2732,7 +2732,7 @@ const struct gcc_debug_hooks dwarf2_lineno_debug_hooks =
   debug_nothing_int_int,                /* begin_block */
   debug_nothing_int_int,                /* end_block */
   debug_true_const_tree,                /* ignore_block */
-  dwarf2out_source_line,        /* source_line */
+  dwarf2out_source_line,                /* source_line */
   debug_nothing_int_charstar,           /* begin_prologue */
   debug_nothing_int_charstar,           /* end_prologue */
   debug_nothing_int_charstar,           /* begin_epilogue */
@@ -6109,7 +6109,7 @@ check_die (dw_die_ref die)
   dw_attr_node *a;
   bool inline_found = false;
   int n_location = 0, n_low_pc = 0, n_high_pc = 0, n_artificial = 0;
-  int n_decl_line = 0, n_decl_file = 0;
+  int n_decl_line = 0, n_decl_column = 0, n_decl_file = 0;
   FOR_EACH_VEC_SAFE_ELT (die->die_attr, ix, a)
     {
       switch (a->dw_attr)
@@ -6130,6 +6130,9 @@ check_die (dw_die_ref die)
        case DW_AT_artificial:
          ++n_artificial;
          break;
+        case DW_AT_decl_column:
+         ++n_decl_column;
+         break;
        case DW_AT_decl_line:
          ++n_decl_line;
          break;
@@ -6141,7 +6144,7 @@ check_die (dw_die_ref die)
        }
     }
   if (n_location > 1 || n_low_pc > 1 || n_high_pc > 1 || n_artificial > 1
-      || n_decl_line > 1 || n_decl_file > 1)
+      || n_decl_column > 1 || n_decl_line > 1 || n_decl_file > 1)
     {
       fprintf (stderr, "Duplicate attributes in DIE:\n");
       debug_dwarf_die (die);
@@ -20190,6 +20193,8 @@ add_src_coords_attributes (dw_die_ref die, tree decl)
   s = expand_location (DECL_SOURCE_LOCATION (decl));
   add_AT_file (die, DW_AT_decl_file, lookup_filename (s.file));
   add_AT_unsigned (die, DW_AT_decl_line, s.line);
+  if (debug_column_info && s.column)
+    add_AT_unsigned (die, DW_AT_decl_column, s.column);
 }
 
 /* Add DW_AT_{,MIPS_}linkage_name attribute for the given decl.  */
@@ -21936,7 +21941,11 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
           && (DECL_ARTIFICIAL (decl)
               || (get_AT_file (old_die, DW_AT_decl_file) == file_index
                   && (get_AT_unsigned (old_die, DW_AT_decl_line)
-                      == (unsigned) s.line))))
+                      == (unsigned) s.line)
+                  && (!debug_column_info
+                      || s.column == 0
+                      || (get_AT_unsigned (old_die, DW_AT_decl_column)
+                          == (unsigned) s.column)))))
        {
          subr_die = old_die;
 
@@ -21963,10 +21972,15 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
            add_AT_file (subr_die, DW_AT_decl_file, file_index);
          if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
            add_AT_unsigned (subr_die, DW_AT_decl_line, s.line);
+         if (debug_column_info
+             && s.column
+             && (get_AT_unsigned (old_die, DW_AT_decl_column)
+                 != (unsigned) s.column))
+           add_AT_unsigned (subr_die, DW_AT_decl_column, s.column);
 
          /* If the prototype had an 'auto' or 'decltype(auto)' return type,
             emit the real type on the definition die.  */
-         if (is_cxx() && debug_info_level > DINFO_LEVEL_TERSE)
+         if (is_cxx () && debug_info_level > DINFO_LEVEL_TERSE)
            {
              dw_die_ref die = get_AT_ref (old_die, DW_AT_type);
              if (die == auto_die || die == decltype_auto_die)
@@ -22838,6 +22852,12 @@ gen_variable_die (tree decl, tree origin, dw_die_ref context_die)
          if (get_AT_unsigned (old_die, DW_AT_decl_line) != (unsigned) s.line)
            add_AT_unsigned (var_die, DW_AT_decl_line, s.line);
 
+         if (debug_column_info
+             && s.column
+             && (get_AT_unsigned (old_die, DW_AT_decl_column)
+                 != (unsigned) s.column))
+           add_AT_unsigned (var_die, DW_AT_decl_column, s.column);
+
          if (old_die->die_tag == DW_TAG_member)
            add_linkage_name (var_die, decl);
        }
@@ -23011,6 +23031,8 @@ add_call_src_coords_attributes (tree stmt, dw_die_ref die)
     {
       add_AT_file (die, DW_AT_call_file, lookup_filename (s.file));
       add_AT_unsigned (die, DW_AT_call_line, s.line);
+      if (debug_column_info && s.column)
+       add_AT_unsigned (die, DW_AT_call_column, s.column);
     }
 }
 
@@ -25547,6 +25569,8 @@ dwarf2out_imported_module_or_decl_1 (tree decl,
 
   add_AT_file (imported_die, DW_AT_decl_file, lookup_filename (xloc.file));
   add_AT_unsigned (imported_die, DW_AT_decl_line, xloc.line);
+  if (debug_column_info && xloc.column)
+    add_AT_unsigned (imported_die, DW_AT_decl_column, xloc.column);
   if (name)
     add_AT_string (imported_die, DW_AT_name,
                   IDENTIFIER_POINTER (name));
@@ -27959,7 +27983,9 @@ move_linkage_attr (dw_die_ref die)
     {
       dw_attr_node *prev = &(*die->die_attr)[ix - 1];
 
-      if (prev->dw_attr == DW_AT_decl_line || prev->dw_attr == DW_AT_name)
+      if (prev->dw_attr == DW_AT_decl_line
+         || prev->dw_attr == DW_AT_decl_column
+         || prev->dw_attr == DW_AT_name)
        break;
     }