[PATCH] D99933: [Debug-Info] Use inlined strings in .dwinfo section by default for DBX.

EsmeYi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 7 04:27:33 PDT 2021


Esme updated this revision to Diff 335777.
Esme added a comment.

Addressed comments.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99933/new/

https://reviews.llvm.org/D99933

Files:
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
  llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
  llvm/lib/CodeGen/CommandFlags.cpp
  llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll


Index: llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
===================================================================
--- llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
+++ llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
@@ -0,0 +1,54 @@
+; 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")
+; CHECK-NEXT:  DW_AT_language [DW_FORM_data2]	(DW_LANG_C99)
+; CHECK-NEXT:  DW_AT_name [DW_FORM_string]	("1.c")
+; CHECK-NEXT:  DW_AT_stmt_list [DW_FORM_sec_offset]	(0x00000000)
+; CHECK-NEXT:  DW_AT_comp_dir [DW_FORM_string]	("debug")
+; CHECK-NEXT:  DW_AT_low_pc [DW_FORM_addr]	(0x0000000000000000 ".text")
+; CHECK-NEXT:  DW_AT_high_pc [DW_FORM_data4]	(0x0000001c)
+
+; CHECK:       DW_AT_low_pc [DW_FORM_addr]	(0x0000000000000000 ".text")
+; CHECK-NEXT:  DW_AT_high_pc [DW_FORM_data4]	(0x0000001c)
+; CHECK-NEXT:  DW_AT_frame_base [DW_FORM_exprloc]	(DW_OP_reg1 X1)
+; CHECK-NEXT:  DW_AT_name [DW_FORM_string]	("main")
+; CHECK-NEXT:  DW_AT_decl_file [DW_FORM_data1]	("debug/1.c")
+; CHECK-NEXT:  DW_AT_decl_line [DW_FORM_data1]	(1)
+; CHECK-NEXT:  DW_AT_prototyped [DW_FORM_flag_present]	(true)
+; CHECK-NEXT:  DW_AT_type [DW_FORM_ref4]	(cu + 0x0057 => {0x00000057} "int")
+; CHECK-NEXT:  DW_AT_external [DW_FORM_flag_present]	(true)
+
+; CHECK:       DW_AT_name [DW_FORM_string]	("int")
+; CHECK-NEXT:  DW_AT_encoding [DW_FORM_data1]	(DW_ATE_signed)
+; CHECK-NEXT:  DW_AT_byte_size [DW_FORM_data1]	(0x04)
+
+
+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)
Index: llvm/lib/CodeGen/CommandFlags.cpp
===================================================================
--- llvm/lib/CodeGen/CommandFlags.cpp
+++ llvm/lib/CodeGen/CommandFlags.cpp
@@ -414,6 +414,7 @@
       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);
 
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.h
@@ -834,6 +834,7 @@
   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);
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -366,7 +366,7 @@
     DebuggerTuning = DebuggerKind::GDB;
 
   if (DwarfInlinedStrings == Default)
-    UseInlineStrings = TT.isNVPTX();
+    UseInlineStrings = TT.isNVPTX() || tuneForDBX();
   else
     UseInlineStrings = DwarfInlinedStrings == Enable;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99933.335777.patch
Type: text/x-patch
Size: 4278 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210407/99ee4930/attachment.bin>


More information about the llvm-commits mailing list