[llvm] 0c36da7 - [Debug-Info] Use inlined strings in .dwinfo section by default for DBX.
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 8 00:21:14 PDT 2021
Author: Esme-Yi
Date: 2021-04-08T07:20:22Z
New Revision: 0c36da722aa55535d35d1423c70fc04ab8889090
URL: https://github.com/llvm/llvm-project/commit/0c36da722aa55535d35d1423c70fc04ab8889090
DIFF: https://github.com/llvm/llvm-project/commit/0c36da722aa55535d35d1423c70fc04ab8889090.diff
LOG: [Debug-Info] Use inlined strings in .dwinfo section by default for DBX.
Summary: Set the default DwarfInlinedStrings as inlined strings for DBX, due to DBX does not support .dwstr section for now.
Reviewed By: dblaikie
Differential Revision: https://reviews.llvm.org/D99933
Added:
llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
Modified:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
llvm/lib/CodeGen/CommandFlags.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 5a1672f8720b..e99684957929 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -366,7 +366,7 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
DebuggerTuning = DebuggerKind::GDB;
if (DwarfInlinedStrings == Default)
- UseInlineStrings = TT.isNVPTX();
+ UseInlineStrings = TT.isNVPTX() || tuneForDBX();
else
UseInlineStrings = DwarfInlinedStrings == Enable;
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
index 83700e837798..77e4f20a2888 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -834,6 +834,7 @@ class DwarfDebug : public DebugHandlerBase {
bool tuneForGDB() const { return DebuggerTuning == DebuggerKind::GDB; }
bool tuneForLLDB() const { return DebuggerTuning == DebuggerKind::LLDB; }
bool tuneForSCE() const { return DebuggerTuning == DebuggerKind::SCE; }
+ bool tuneForDBX() const { return DebuggerTuning == DebuggerKind::DBX; }
/// @}
const MCSymbol *getSectionLabel(const MCSection *S);
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index 97c110afdda4..ed0dc705d37e 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -414,6 +414,7 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
cl::values(
clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
+ clEnumValN(DebuggerKind::DBX, "dbx", "dbx"),
clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
CGBINDOPT(DebuggerTuningOpt);
diff --git a/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll b/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
new file mode 100644
index 000000000000..7f65d300d6fe
--- /dev/null
+++ b/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
@@ -0,0 +1,33 @@
+; RUN: llc -debugger-tune=dbx -filetype=obj < %s | llvm-dwarfdump -v - | \
+; RUN: FileCheck %s -implicit-check-not DW_FORM_strp
+
+; CHECK: DW_AT_producer [DW_FORM_string] ("clang version 12.0.0")
+
+source_filename = "1.c"
+target datalayout = "E-m:a-p:32:32-i64:64-n32"
+
+; Function Attrs: noinline nounwind optnone
+define i32 @main() #0 !dbg !8 {
+entry:
+ %retval = alloca i32, align 4
+ store i32 0, i32* %retval, align 4
+ ret i32 0, !dbg !12
+}
+
+!llvm.dbg.cu = !{!0}
+!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.ident = !{!7}
+
+!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
+!1 = !DIFile(filename: "1.c", directory: "debug")
+!2 = !{}
+!3 = !{i32 7, !"Dwarf Version", i32 4}
+!4 = !{i32 2, !"Debug Info Version", i32 3}
+!5 = !{i32 1, !"wchar_size", i32 2}
+!6 = !{i32 7, !"PIC Level", i32 2}
+!7 = !{!"clang version 12.0.0"}
+!8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
+!9 = !DISubroutineType(types: !10)
+!10 = !{!11}
+!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!12 = !DILocation(line: 3, column: 3, scope: !8)
More information about the llvm-commits
mailing list