[PATCH] D136187: [clang][AIX] Omitting Explicit Debugger Tuning Option
Qiongsi Wu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 18 10:50:40 PDT 2022
qiongsiwu1 created this revision.
qiongsiwu1 added reviewers: shchenz, lkail.
qiongsiwu1 added projects: clang, debug-info.
Herald added a project: All.
qiongsiwu1 requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
On AIX, the default tuning option is `dbx` so it is not necessary to explicitly set `-debugger-tuning=dbx` in the presence of `-g`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D136187
Files:
clang/lib/Driver/ToolChains/AIX.h
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/Driver/debug-options.c
Index: clang/test/Driver/debug-options.c
===================================================================
--- clang/test/Driver/debug-options.c
+++ clang/test/Driver/debug-options.c
@@ -116,17 +116,23 @@
// RUN: %clang -### %s -g -target x86_64-scei-ps5 2>&1 \
// RUN: | FileCheck -check-prefix=LDGARANGE %s
-// On the AIX, -g defaults to -gdbx and limited debug info.
+// On the AIX, -g defaults to limited debug info.
// RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \
-// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_DBX %s
+// RUN: | FileCheck -check-prefix=G_LIMITED %s
// RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \
-// RUN: | FileCheck -check-prefix=G_LIMITED -check-prefix=G_DBX %s
+// RUN: | FileCheck -check-prefix=G_LIMITED %s
+// RUN: %clang -### -c -g -gdbx %s -target powerpc64-ibm-aix-xcoff 2>&1 \
+// RUN: | FileCheck -check-prefixes=G_LIMITED,G_DBX %s
// For DBX, -g defaults to -gstrict-dwarf.
// RUN: %clang -### -c -g %s -target powerpc-ibm-aix-xcoff 2>&1 \
// RUN: | FileCheck -check-prefix=STRICT %s
// RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff 2>&1 \
// RUN: | FileCheck -check-prefix=STRICT %s
+// RUN: %clang -### -c -g -gdbx %s -target powerpc-ibm-aix-xcoff 2>&1 \
+// RUN: | FileCheck -check-prefix=STRICT %s
+// RUN: %clang -### -c -g -gdbx %s -target powerpc64-ibm-aix-xcoff 2>&1 \
+// RUN: | FileCheck -check-prefix=STRICT %s
// RUN: %clang -### -c -g -gno-strict-dwarf %s -target powerpc-ibm-aix-xcoff \
// RUN: 2>&1 | FileCheck -check-prefix=NOSTRICT %s
// RUN: %clang -### -c -g %s -target x86_64-linux-gnu 2>&1 \
@@ -143,6 +149,10 @@
// RUN: | FileCheck -check-prefix=CI %s
// RUN: %clang -### -c -g %s -target powerpc64-ibm-aix-xcoff -gcolumn-info \
// RUN: 2>&1 | FileCheck -check-prefix=CI %s
+// RUN: %clang -### -c -g -gdbx %s -target powerpc-ibm-aix-xcoff \
+// RUN: -gcolumn-info 2>&1 | FileCheck -check-prefix=CI %s
+// RUN: %clang -### -c -g -gdbx %s -target powerpc64-ibm-aix-xcoff \
+// RUN: -gcolumn-info 2>&1 | FileCheck -check-prefix=CI %s
// WebAssembly.
// WebAssembly should default to DWARF4.
Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4259,13 +4259,17 @@
DebugInfoKind == codegenoptions::DebugDirectivesOnly)
DebugInfoKind = codegenoptions::NoDebugInfo;
+ const bool UseDBX =
+ DebuggerTuning == llvm::DebuggerKind::DBX ||
+ (DebuggerTuning == llvm::DebuggerKind::Default && T.isOSAIX());
// strict DWARF is set to false by default. But for DBX, we need it to be set
// as true by default.
if (const Arg *A = Args.getLastArg(options::OPT_gstrict_dwarf))
(void)checkDebugInfoOption(A, Args, D, TC);
if (Args.hasFlag(options::OPT_gstrict_dwarf, options::OPT_gno_strict_dwarf,
- DebuggerTuning == llvm::DebuggerKind::DBX))
+ UseDBX)) {
CmdArgs.push_back("-gstrict-dwarf");
+ }
// And we handle flag -grecord-gcc-switches later with DWARFDebugFlags.
Args.ClaimAllArgs(options::OPT_g_flags_Group);
@@ -4280,8 +4284,7 @@
(void)checkDebugInfoOption(A, Args, D, TC);
if (!Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
!EmitCodeView &&
- (DebuggerTuning != llvm::DebuggerKind::SCE &&
- DebuggerTuning != llvm::DebuggerKind::DBX)))
+ (DebuggerTuning != llvm::DebuggerKind::SCE && !UseDBX)))
CmdArgs.push_back("-gno-column-info");
// FIXME: Move backend command line options to the module.
Index: clang/lib/Driver/ToolChains/AIX.h
===================================================================
--- clang/lib/Driver/ToolChains/AIX.h
+++ clang/lib/Driver/ToolChains/AIX.h
@@ -88,7 +88,7 @@
unsigned GetDefaultDwarfVersion() const override { return 3; }
llvm::DebuggerKind getDefaultDebuggerTuning() const override {
- return llvm::DebuggerKind::DBX;
+ return llvm::DebuggerKind::Default;
}
protected:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D136187.468618.patch
Type: text/x-patch
Size: 4319 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221018/fb0cb492/attachment-0001.bin>
More information about the cfe-commits
mailing list