summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2019-04-16 00:16:29 +0000
committerDavid Blaikie <dblaikie@gmail.com>2019-04-16 00:16:29 +0000
commitb068f92d94a5c42ff21bfdf29344c54e2688dac3 (patch)
tree72d27cb21167a57aa5e71581817a1983c79611d5
parent728780bfadfeae6dd9b7124d490be7d9f6c33de6 (diff)
downloadbcm5719-llvm-b068f92d94a5c42ff21bfdf29344c54e2688dac3.tar.gz
bcm5719-llvm-b068f92d94a5c42ff21bfdf29344c54e2688dac3.zip
DebugInfo: Default to standalone debug when tuning for LLDB
LLDB can't currently handle Clang's default (limit/no-standalone) DWARF, so platforms that default to LLDB (Darwin) or anyone else manually requesting LLDB tuning, should also get standalone DWARF. That doesn't mean a user can't explicitly enable (because they have other reasons to prefer standalone DWARF (such as that they're only building half their application with debug info enabled, and half without - or because they're tuning for GDB, but want to be able to use it under LLDB too (this is the default on FreeBSD))) or disable (testing LLDB fixes/improvements that handle no-standalone mode, building C code, perhaps, which wouldn't have the LLDB<>no-standalone conflict, etc) the feature regardless of the tuning. llvm-svn: 358464
-rw-r--r--clang/lib/Driver/ToolChains/Clang.cpp7
-rw-r--r--clang/test/Driver/debug-options.c21
2 files changed, 14 insertions, 14 deletions
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 0d76aaaacf5..5620a543438 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -3295,9 +3295,10 @@ static void RenderDebugOptions(const ToolChain &TC, const Driver &D,
// figure out if we need to "upgrade" it to standalone debug info.
// We parse these two '-f' options whether or not they will be used,
// to claim them even if you wrote "-fstandalone-debug -gline-tables-only"
- bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug,
- options::OPT_fno_standalone_debug,
- TC.GetDefaultStandaloneDebug());
+ bool NeedFullDebug = Args.hasFlag(
+ options::OPT_fstandalone_debug, options::OPT_fno_standalone_debug,
+ DebuggerTuning == llvm::DebuggerKind::LLDB ||
+ TC.GetDefaultStandaloneDebug());
if (const Arg *A = Args.getLastArg(options::OPT_fstandalone_debug))
(void)checkDebugInfoOption(A, Args, D, TC);
if (DebugInfoKind == codegenoptions::LimitedDebugInfo && NeedFullDebug)
diff --git a/clang/test/Driver/debug-options.c b/clang/test/Driver/debug-options.c
index 6acc7e8f174..dce72ff17d7 100644
--- a/clang/test/Driver/debug-options.c
+++ b/clang/test/Driver/debug-options.c
@@ -3,26 +3,26 @@
// Linux.
// RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s
// RUN: %clang -### -c -g2 %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s
// RUN: %clang -### -c -g3 %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s
// RUN: %clang -### -c -ggdb %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_GDB %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s
// RUN: %clang -### -c -ggdb1 %s -target x86_64-linux-gnu 2>&1 \
// RUN: | FileCheck -check-prefix=GLTO_ONLY -check-prefix=G_GDB %s
// RUN: %clang -### -c -ggdb3 %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_GDB %s
// RUN: %clang -### -c -glldb %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_LLDB %s
+// RUN: | FileCheck -check-prefix=G_STANDALONE -check-prefix=G_LLDB %s
// RUN: %clang -### -c -gsce %s -target x86_64-linux-gnu 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_SCE %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_SCE %s
// Android.
// Android should always generate DWARF4.
// RUN: %clang -### -c -g %s -target arm-linux-androideabi 2>&1 \
-// RUN: | FileCheck -check-prefix=G -check-prefix=G_DWARF4 %s
+// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_DWARF4 %s
// Darwin.
// RUN: %clang -### -c -g %s -target x86_64-apple-darwin14 2>&1 \
@@ -231,9 +231,6 @@
// RUN: %clang -### -target %itanium_abi_triple -gmodules -gline-directives-only %s 2>&1 \
// RUN: | FileCheck -check-prefix=GLIO_ONLY %s
//
-// G: "-cc1"
-// G: "-debug-info-kind=limited"
-//
// NOG_PS4: "-cc1"
// NOG_PS4-NOT "-dwarf-version=
// NOG_PS4: "-generate-arange-section"
@@ -277,6 +274,8 @@
//
// G_STANDALONE: "-cc1"
// G_STANDALONE: "-debug-info-kind=standalone"
+// G_LIMITED: "-cc1"
+// G_LIMITED: "-debug-info-kind=limited"
// G_DWARF2: "-dwarf-version=2"
// G_DWARF4: "-dwarf-version=4"
//
OpenPOWER on IntegriCloud