Skip to content

Commit b3ae6c2

Browse files
authored
[CLANG][DWARF] Do not emit -ggnu-pubnames for split dwarf version 5. (#82840)
When -gsplit-dwarf is passed in clang emmmits -ggnu-pubnames which results in .debug_gnu_pubnames/..debug_gnu_pubtypes being generated. This is used by GDB, but not by LLDB. Changed so that these sections are not emitted for LLDB tuning.
1 parent 13c359a commit b3ae6c2

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4479,9 +4479,10 @@ renderDebugOptions(const ToolChain &TC, const Driver &D, const llvm::Triple &T,
44794479
options::OPT_gpubnames, options::OPT_gno_pubnames);
44804480
if (DwarfFission != DwarfFissionKind::None ||
44814481
(PubnamesArg && checkDebugInfoOption(PubnamesArg, Args, D, TC)))
4482-
if (!PubnamesArg ||
4483-
(!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&
4484-
!PubnamesArg->getOption().matches(options::OPT_gno_pubnames)))
4482+
if (DebuggerTuning != llvm::DebuggerKind::LLDB &&
4483+
(!PubnamesArg ||
4484+
(!PubnamesArg->getOption().matches(options::OPT_gno_gnu_pubnames) &&
4485+
!PubnamesArg->getOption().matches(options::OPT_gno_pubnames))))
44854486
CmdArgs.push_back(PubnamesArg && PubnamesArg->getOption().matches(
44864487
options::OPT_gpubnames)
44874488
? "-gpubnames"

clang/test/Driver/split-debug.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,3 +124,8 @@
124124
// G1_NOSPLIT: "-debug-info-kind=line-tables-only"
125125
// G1_NOSPLIT-NOT: "-split-dwarf-file"
126126
// G1_NOSPLIT-NOT: "-split-dwarf-output"
127+
128+
/// Do not generate -ggnu-pubnames for -glldb
129+
// RUN: %clang -### -c -target x86_64 -gsplit-dwarf -g -glldb %s 2>&1 | FileCheck %s --check-prefixes=GLLDBSPLIT
130+
131+
// GLLDBSPLIT-NOT: "-ggnu-pubnames"

0 commit comments

Comments
 (0)