From: David Blaikie Date: Wed, 24 Aug 2016 18:29:58 +0000 (+0000) Subject: DebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ba62c3b9c934c96a4d392b40a89a10fdc2fa3de2;p=clang DebugInfo: Add flag to CU to disable emission of inline debug info into the skeleton CU In cases where .dwo/.dwp files are guaranteed to be available, skipping the extra online (in the .o file) inline info can save a substantial amount of space - see the original r221306 for more details there. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@279651 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Driver/Options.td b/include/clang/Driver/Options.td index 57d5bcb990..44e588d569 100644 --- a/include/clang/Driver/Options.td +++ b/include/clang/Driver/Options.td @@ -1255,6 +1255,10 @@ def fdebug_types_section: Flag <["-"], "fdebug-types-section">, Group, Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">; def fno_debug_types_section: Flag<["-"], "fno-debug-types-section">, Group, Flags<[CC1Option]>; +def fsplit_dwarf_inlining: Flag <["-"], "fsplit-dwarf-inlining">, Group, + Flags<[CC1Option]>, HelpText<"Place debug types in their own section (ELF Only)">; +def fno_split_dwarf_inlining: Flag<["-"], "fno-split-dwarf-inlining">, Group, + Flags<[CC1Option]>; def fdebug_prefix_map_EQ : Joined<["-"], "fdebug-prefix-map=">, Group, Flags<[CC1Option]>, HelpText<"remap file source paths in debug info">; diff --git a/include/clang/Frontend/CodeGenOptions.def b/include/clang/Frontend/CodeGenOptions.def index 51b0cf676c..4dd634c72a 100644 --- a/include/clang/Frontend/CodeGenOptions.def +++ b/include/clang/Frontend/CodeGenOptions.def @@ -194,6 +194,9 @@ CODEGENOPT(DebugTypeExtRefs, 1, 0) ///< Whether or not debug info should contain CODEGENOPT(DebugExplicitImport, 1, 0) ///< Whether or not debug info should ///< contain explicit imports for ///< anonymous namespaces +CODEGENOPT(SplitDwarfInlining, 1, 1) ///< Whether to include inlining info in the + ///< skeleton CU to allow for symbolication + ///< of inline stack frames without .dwo files. CODEGENOPT(EmitLLVMUseLists, 1, 0) ///< Control whether to serialize use-lists. diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index d515e1a31f..2f250d853e 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -454,7 +454,8 @@ void CGDebugInfo::CreateCompileUnit() { TheCU = DBuilder.createCompileUnit( LangTag, remapDIPath(MainFileName), remapDIPath(getCurrentDirname()), Producer, LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers, - CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */); + CGM.getCodeGenOpts().SplitDwarfFile, EmissionKind, 0 /* DWOid */, + CGM.getCodeGenOpts().SplitDwarfInlining); } llvm::DIType *CGDebugInfo::CreateType(const BuiltinType *BT) { diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp index 895104e1c4..c1d68bc37c 100644 --- a/lib/Driver/Tools.cpp +++ b/lib/Driver/Tools.cpp @@ -4697,6 +4697,10 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("-generate-type-units"); } + if (!Args.hasFlag(options::OPT_fsplit_dwarf_inlining, + options::OPT_fno_split_dwarf_inlining, true)) + CmdArgs.push_back("-fno-split-dwarf-inlining"); + // CloudABI and WebAssembly use -ffunction-sections and -fdata-sections by // default. bool UseSeparateSections = Triple.getOS() == llvm::Triple::CloudABI || diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 69c4593d5f..97c37defa1 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -499,6 +499,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK, Opts.WholeProgramVTables = Args.hasArg(OPT_fwhole_program_vtables); Opts.LTOVisibilityPublicStd = Args.hasArg(OPT_flto_visibility_public_std); Opts.SplitDwarfFile = Args.getLastArgValue(OPT_split_dwarf_file); + Opts.SplitDwarfInlining = !Args.hasArg(OPT_fno_split_dwarf_inlining); Opts.DebugTypeExtRefs = Args.hasArg(OPT_dwarf_ext_refs); Opts.DebugExplicitImport = Triple.isPS4CPU(); diff --git a/test/CodeGen/debug-info-imported-entity.cpp b/test/CodeGen/debug-info-imported-entity.cpp index 105cc3dc53..c7935eda48 100644 --- a/test/CodeGen/debug-info-imported-entity.cpp +++ b/test/CodeGen/debug-info-imported-entity.cpp @@ -3,9 +3,7 @@ namespace std { class A; } using std::A; using ::A; - -// CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]]) +// CHECK: [[CompileUnit:![0-9]+]] = distinct !DICompileUnit({{.+}} imports: [[Imports:![0-9]+]] // CHECK: [[Imports]] = !{[[ImportedEntity:![0-9]+]]} // CHECK: [[ImportedEntity]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CompileUnit]], entity: [[STDA:![0-9]+]], line: 4) // CHECK: [[STDA]] = !DICompositeType(tag: DW_TAG_class_type, name: "A", - diff --git a/test/CodeGen/split-debug-filename.c b/test/CodeGen/split-debug-filename.c index 63970a83df..43daeada96 100644 --- a/test/CodeGen/split-debug-filename.c +++ b/test/CodeGen/split-debug-filename.c @@ -1,7 +1,7 @@ -// RUN: %clang -target x86_64-linux-gnu -gsplit-dwarf -S -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=limited -split-dwarf-file foo.dwo -S -emit-llvm -o - %s | FileCheck %s int main (void) { return 0; } // Testing to ensure that the dwo name gets output into the compile unit. -// CHECK: split-debug-filename.dwo +// CHECK: !DICompileUnit({{.*}}, splitDebugFilename: "foo.dwo" diff --git a/test/CodeGen/split-debug-inlining.c b/test/CodeGen/split-debug-inlining.c new file mode 100644 index 0000000000..4a306d43e9 --- /dev/null +++ b/test/CodeGen/split-debug-inlining.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -debug-info-kind=limited -fno-split-dwarf-inlining -S -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -debug-info-kind=limited -S -emit-llvm -o - %s | FileCheck --check-prefix=ABSENT %s +void f(void) {} +// Verify that disabling split debug inlining info is propagated to the debug +// info metadata. +// CHECK: !DICompileUnit({{.*}}, splitDebugInlining: false +// ABSENT-NOT: splitDebugInlining