r280290 - DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
David Blaikie via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 31 13:54:36 PDT 2016
Author: dblaikie
Date: Wed Aug 31 15:54:35 2016
New Revision: 280290
URL: http://llvm.org/viewvc/llvm-project?rev=280290&view=rev
Log:
DebugInfo: Fix -gsplit-dwarf + -fno-split-dwarf-inlining
I tested the cases involving split-dwarf + gmlt +
no-split-dwarf-inlining, but didn't verify the simpler case without
gmlt.
The logic is, admittedly, a little hairy, but seems about as simple as I
could wrangle it.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/split-debug.c
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=280290&r1=280289&r2=280290&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Aug 31 15:54:35 2016
@@ -4602,8 +4602,6 @@ void Clang::ConstructJob(Compilation &C,
bool splitDwarfInlining =
Args.hasFlag(options::OPT_fsplit_dwarf_inlining,
options::OPT_fno_split_dwarf_inlining, true);
- if (!splitDwarfInlining)
- CmdArgs.push_back("-fno-split-dwarf-inlining");
Args.ClaimAllArgs(options::OPT_g_Group);
Arg *SplitDwarfArg = Args.getLastArg(options::OPT_gsplit_dwarf);
@@ -4619,11 +4617,15 @@ void Clang::ConstructJob(Compilation &C,
// split-dwarf and line-tables-only, so let those compose naturally in
// that case.
// And if you just turned off debug info, (-gsplit-dwarf -g0) - do that.
- if (SplitDwarfArg && A->getIndex() > SplitDwarfArg->getIndex() &&
- ((DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
- splitDwarfInlining) ||
- DebugInfoKind == codegenoptions::NoDebugInfo))
- SplitDwarfArg = nullptr;
+ if (SplitDwarfArg) {
+ if (A->getIndex() > SplitDwarfArg->getIndex()) {
+ if (DebugInfoKind == codegenoptions::NoDebugInfo ||
+ (DebugInfoKind == codegenoptions::DebugLineTablesOnly &&
+ splitDwarfInlining))
+ SplitDwarfArg = nullptr;
+ } else if (splitDwarfInlining)
+ DebugInfoKind = codegenoptions::NoDebugInfo;
+ }
} else
// For any other 'g' option, use Limited.
DebugInfoKind = codegenoptions::LimitedDebugInfo;
@@ -4678,7 +4680,9 @@ void Clang::ConstructJob(Compilation &C,
// splitting and extraction.
// FIXME: Currently only works on Linux.
if (getToolChain().getTriple().isOSLinux() && SplitDwarfArg) {
- if (splitDwarfInlining)
+ if (!splitDwarfInlining)
+ CmdArgs.push_back("-fno-split-dwarf-inlining");
+ if (DebugInfoKind == codegenoptions::NoDebugInfo)
DebugInfoKind = codegenoptions::LimitedDebugInfo;
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-split-dwarf=Enable");
Modified: cfe/trunk/test/Driver/split-debug.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/split-debug.c?rev=280290&r1=280289&r2=280290&view=diff
==============================================================================
--- cfe/trunk/test/Driver/split-debug.c (original)
+++ cfe/trunk/test/Driver/split-debug.c Wed Aug 31 15:54:35 2016
@@ -47,6 +47,13 @@
// CHECK-SPLIT-WITH-GMLT: "-debug-info-kind=line-tables-only"
// CHECK-SPLIT-WITH-GMLT: "-split-dwarf-file"
+// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -fno-split-dwarf-inlining -S -### %s 2> %t
+// RUN: FileCheck -check-prefix=CHECK-SPLIT-WITH-NOINL < %t %s
+//
+// CHECK-SPLIT-WITH-NOINL: "-split-dwarf=Enable"
+// CHECK-SPLIT-WITH-NOINL: "-debug-info-kind=limited"
+// CHECK-SPLIT-WITH-NOINL: "-split-dwarf-file"
+
// RUN: %clang -target x86_64-unknown-linux-gnu -gsplit-dwarf -gmlt -S -### %s 2> %t
// RUN: FileCheck -check-prefix=CHECK-GMLT-OVER-SPLIT < %t %s
//
More information about the cfe-commits
mailing list