PR other/69821
  * common.opt (grecord-debug-prefix-map, gno-record-debug-prefix-map):
    New options.
  * dwarf2out.c:(gen_producer_string) Use option to filter
    -fdebug-prefix-map
  * doc/invoke.texi: Document -grecord-debug-prefix-map and
    -gno-record-debug-prefix-map.

Signed-off-by: Hongxu Jia <hongxu....@windriver.com>
---
 gcc/common.opt      |  8 ++++++++
 gcc/doc/invoke.texi | 14 ++++++++++++++
 gcc/dwarf2out.c     |  8 ++++++++
 3 files changed, 30 insertions(+)

diff --git a/gcc/common.opt b/gcc/common.opt
index 2259f29..3aef05a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2464,6 +2464,14 @@ grecord-gcc-switches
 Common RejectNegative Var(dwarf_record_gcc_switches,1)
 Record gcc command line switches in DWARF DW_AT_producer.
 
+gno-record-debug-prefix-map
+Common RejectNegative Var(dwarf_record_debug_prefix_map,0) Init(1)
+Don't record -fdebug-prefix-map in gcc command line switches in DWARF 
DW_AT_producer.
+
+grecord-debug-prefix-map
+Common RejectNegative Var(dwarf_record_debug_prefix_map,1)
+Record -fdebug-prefix-map in gcc command line switches in DWARF DW_AT_producer.
+
 gno-split-dwarf
 Common Driver RejectNegative Var(dwarf_split_debug_info,0) Init(0)
 Don't generate debug information in separate .dwo files
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 9d8ffc0..d18d24a 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -337,6 +337,7 @@ Objective-C and Objective-C++ Dialects}.
 -fsel-sched-verbose -fsel-sched-dump-cfg -fsel-sched-pipelining-verbose @gol
 -fstack-usage  -ftest-coverage  -ftime-report -fvar-tracking @gol
 -fvar-tracking-assignments  -fvar-tracking-assignments-toggle @gol
+-grecord-debug-prefix-map-gstabs  -gno-record-debug-prefix-map @gol
 -g  -g@var{level}  -gtoggle  -gcoff  -gdwarf-@var{version} @gol
 -ggdb  -grecord-gcc-switches  -gno-record-gcc-switches @gol
 -gstabs  -gstabs+  -gstrict-dwarf  -gno-strict-dwarf @gol
@@ -5220,6 +5221,19 @@ way of storing compiler options into the object file.  
This is the default.
 Disallow appending command-line options to the DW_AT_producer attribute
 in DWARF debugging information.
 
+@item -grecord-debug-prefix-map-gstabs
+@opindex grecord-debug-prefix-map-gstabs
+While -grecord-gcc-switches and -fdebug-prefix-map used, keep
+-fdebug-prefix-map in command line options which is appended
+to the DW_AT_producer attribute in DWARF debugging information.
+This is the default.
+
+@item -gno-record-debug-prefix-map
+@opindex gno-record-debug-prefix-map
+While -grecord-gcc-switches and -fdebug-prefix-map used, remove
+-fdebug-prefix-map in command line options which is appended
+to the DW_AT_producer attribute in DWARF debugging information.
+
 @item -gstrict-dwarf
 @opindex gstrict-dwarf
 Disallow using extensions of later DWARF standard version than selected
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 13b2de7..19a149a 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19182,6 +19182,8 @@ gen_producer_string (void)
       case OPT_SPECIAL_input_file:
       case OPT_grecord_gcc_switches:
       case OPT_gno_record_gcc_switches:
+      case OPT_grecord_debug_prefix_map:
+      case OPT_gno_record_debug_prefix_map:
       case OPT__output_pch_:
       case OPT_fdiagnostics_show_location_:
       case OPT_fdiagnostics_show_option:
@@ -19214,6 +19216,12 @@ gen_producer_string (void)
          default:
            break;
          }
+
+       /* Don't record -fdebug-prefix-map in gcc command line
+          switches in DWARF DW_AT_producer */
+       if (save_decoded_options[j].opt_index==OPT_fdebug_prefix_map_ &&
+           !dwarf_record_debug_prefix_map)
+         continue;
        switches.safe_push (save_decoded_options[j].orig_option_with_args_text);
        len += strlen (save_decoded_options[j].orig_option_with_args_text) + 1;
        break;
-- 
1.9.1

Reply via email to