diff mbox series

Add -fsplit-dwarf

Message ID 20200512231734.102025-1-maskray@google.com
State New
Headers show
Series Add -fsplit-dwarf | expand

Commit Message

Fangrui Song May 12, 2020, 11:17 p.m. UTC
-fsplit-dwarf is similar to -gsplit-dwarf, but does not enable debugging
information by itself. This makes it easier to be plugged into a build
system without worrying that unnecessary debugging information may be
generated.

2020-05-12  Fangrui Song  <maskray@google.com>

	PR debug/95096
	* common.opt: Add -fsplit-dwarf.
	* doc/invoke.texi: Document it.
---
 gcc/common.opt      | 4 ++++
 gcc/doc/invoke.texi | 8 ++++++++
 2 files changed, 12 insertions(+)

Comments

Richard Biener May 13, 2020, 6:55 a.m. UTC | #1
On Wed, May 13, 2020 at 1:40 AM Fangrui Song via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> -fsplit-dwarf is similar to -gsplit-dwarf, but does not enable debugging
> information by itself. This makes it easier to be plugged into a build
> system without worrying that unnecessary debugging information may be
> generated.

Hmm.  I think having both -fsplit-dwarf and -gsplit-dwarf is confusing.  Doesn't
feeding -g0 -gsplit-dwarf into the build system work with a later -g then
enabling debug info generation?

Having said that my preference would be (in the following order):

 1) make -gsplit-dwarf not imply -g
 2) add -gsplit-dwarf0 implying -g0 (and maybe accept -gsplit-dwarf[012])

for 1) the ship may have sailed.  For 2) it might be confused
with -gdwarf2 so maybe it should be -g0split-dwarf.  Eh.

I still like 1) most.

Oh, and -gsplit-dwarf is largely unmaintained.

Did I mention I dislike -fsplit-dwarf? ;)

Richard.

> 2020-05-12  Fangrui Song  <maskray@google.com>
>
>         PR debug/95096
>         * common.opt: Add -fsplit-dwarf.
>         * doc/invoke.texi: Document it.
> ---
>  gcc/common.opt      | 4 ++++
>  gcc/doc/invoke.texi | 8 ++++++++
>  2 files changed, 12 insertions(+)
>
> diff --git a/gcc/common.opt b/gcc/common.opt
> index 4464049fc1f..07aa9f28002 100644
> --- a/gcc/common.opt
> +++ b/gcc/common.opt
> @@ -2515,6 +2515,10 @@ fsingle-precision-constant
>  Common Report Var(flag_single_precision_constant) Optimization
>  Convert floating point constants to single precision constants.
>
> +fsplit-dwarf
> +Common Driver Var(dwarf_split_debug_info) Init(0)
> +If debug information is enabled, generate debug information in separate .dwo files.
> +
>  fsplit-ivs-in-unroller
>  Common Report Var(flag_split_ivs_in_unroller) Init(1) Optimization
>  Split lifetimes of induction variables when loops are unrolled.
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 850aeac033d..6590e60f5b3 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -448,6 +448,7 @@ Objective-C and Objective-C++ Dialects}.
>  -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
>  -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
>  -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
> +-fsplit-dwarf @gol
>  -fvar-tracking  -fvar-tracking-assignments}
>
>  @item Optimization Options
> @@ -8771,6 +8772,13 @@ also be used to change an absolute path to a relative path by using
>  are location independent, but may require an extra command to tell GDB
>  where to find the source files. See also @option{-ffile-prefix-map}.
>
> +@item -fsplit-dwarf
> +@opindex fsplit-dwarf
> +If DWARF debugging information is enabled, separate as much debugging
> +information as possible into a separate output file with the extension
> +@file{.dwo}. This is similar to @option{-gsplit-dwarf}, but this option
> +does not enable debugging information by itself.
> +
>  @item -fvar-tracking
>  @opindex fvar-tracking
>  Run variable tracking pass.  It computes where variables are stored at each
> --
> 2.26.2.645.ge9eca65c58-goog
>
Eric Botcazou May 13, 2020, 9:48 a.m. UTC | #2
> Did I mention I dislike -fsplit-dwarf? ;)

Seconded, this will be confusing for almost all users.  Since the option only 
affects debug info generation, it should be prefixed with 'g' in any case.
diff mbox series

Patch

diff --git a/gcc/common.opt b/gcc/common.opt
index 4464049fc1f..07aa9f28002 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -2515,6 +2515,10 @@  fsingle-precision-constant
 Common Report Var(flag_single_precision_constant) Optimization
 Convert floating point constants to single precision constants.
 
+fsplit-dwarf
+Common Driver Var(dwarf_split_debug_info) Init(0)
+If debug information is enabled, generate debug information in separate .dwo files.
+
 fsplit-ivs-in-unroller
 Common Report Var(flag_split_ivs_in_unroller) Init(1) Optimization
 Split lifetimes of induction variables when loops are unrolled.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 850aeac033d..6590e60f5b3 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -448,6 +448,7 @@  Objective-C and Objective-C++ Dialects}.
 -femit-struct-debug-detailed@r{[}=@var{spec-list}@r{]} @gol
 -fno-eliminate-unused-debug-symbols  -femit-class-debug-always @gol
 -fno-merge-debug-strings  -fno-dwarf2-cfi-asm @gol
+-fsplit-dwarf @gol
 -fvar-tracking  -fvar-tracking-assignments}
 
 @item Optimization Options
@@ -8771,6 +8772,13 @@  also be used to change an absolute path to a relative path by using
 are location independent, but may require an extra command to tell GDB
 where to find the source files. See also @option{-ffile-prefix-map}.
 
+@item -fsplit-dwarf
+@opindex fsplit-dwarf
+If DWARF debugging information is enabled, separate as much debugging
+information as possible into a separate output file with the extension
+@file{.dwo}. This is similar to @option{-gsplit-dwarf}, but this option
+does not enable debugging information by itself.
+
 @item -fvar-tracking
 @opindex fvar-tracking
 Run variable tracking pass.  It computes where variables are stored at each