[cfe-dev] -gsplit-dwarf implies -g
Fangrui Song via cfe-dev
cfe-dev at lists.llvm.org
Wed May 13 15:32:28 PDT 2020
-gsplit-dwarf takes part in the computation of amount of debugging information
if (const Arg *A =
DebugInfoKind = codegenoptions::LimitedDebugInfo;
// If the last option explicitly specified a debug-info level, use it.
if (checkDebugInfoOption(A, Args, D, TC) &&
DebugInfoKind = DebugLevelToInfoKind(*A);
// For -g0 or -gline-tables-only, drop -gsplit-dwarf. This gets a bit more
// complicated if you've disabled inline info in the skeleton CUs
// (SplitDWARFInlining) - then there's value in composing split-dwarf and
// line-tables-only, so let those compose naturally in that case.
if (DebugInfoKind == codegenoptions::NoDebugInfo ||
DebugInfoKind == codegenoptions::DebugDirectivesOnly ||
(DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
DwarfFission = DwarfFissionKind::None;
This order dependency with other g_Group options (-g0, -g1, -g2, -ggdb3, -gdwarf-5, etc)
makes it somewhat inconvenient to use in a build system:
* -g0 -gsplit-dwarf -> level 2
-gsplit-dwarf "upgrades" the amount of debugging information despite the previous intention (-g0) to drop debugging information
* -g1 -gsplit-dwarf -> level 2
-gsplit-dwarf "upgrades" the amount of debugging information.
I guess using "-g0 -gsplit-dwarf" as a whole might be able to get rid of some
order dependency in clang but it will not work greatly in gcc which has another
What do people think we should do to make -gsplit-dwarf less confusing?
Add another -f flag (-fsplit-dwarf? -fdebug-*?)
Update -gsplit-dwarf to not imply -g? (If we coordinate well with GCC people, I think this is still doable
There is a whole group (g_flags_Group) of -g options which do not takes part in the computation of amount of debugging information
(-gz, -grecord-command-line, -gstrict-dwarf, etc).
Honestly I would hope -gdwarf-5 did not affect DebugInfoKind (we would not need -fdebug-default-version=5)
but the -gdwarf- ship has sailed.
More information about the cfe-dev