[PATCH] D78865: [DWARF5] Replace emission of strp with stx forms in debug_macro section
Sourabh Singh Tomar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 25 10:36:46 PDT 2020
SouraVX created this revision.
SouraVX added reviewers: dblaikie, ikudrin, probinson, jini.susan.george.
SouraVX added a project: debug-info.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
SouraVX added a parent revision: D78736: [DWARF5]: Added support for dumping strx forms in llvm-dwarfdump.
SouraVX added a child revision: D78866: [DWARF5] Added support for emission of debug_macro.dwo section.
DW_MACRO_define_strx forms are supported now in llvm-dwarfdump and these forms can be used in both debug_macro[.dwo] sections. An added advantage for using strx forms over strp forms is that it uses indices approach instead of a relocation to `debug_str` section.
This patch unify the emission for `debug_macro` section.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D78865
Files:
llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
llvm/test/DebugInfo/X86/debug-macro-v5.ll
Index: llvm/test/DebugInfo/X86/debug-macro-v5.ll
===================================================================
--- llvm/test/DebugInfo/X86/debug-macro-v5.ll
+++ llvm/test/DebugInfo/X86/debug-macro-v5.ll
@@ -11,12 +11,12 @@
; CHECK-NEXT: macro header: version = 0x0005, flags = 0x02, debug_line_offset = 0x0000
; CHECK-NEXT: DW_MACRO_start_file - lineno: 0 filenum: 0
; CHECK-NEXT: DW_MACRO_start_file - lineno: 1 filenum: 1
-; CHECK-NEXT: DW_MACRO_define_strp - lineno: 1 macro: FOO 5
+; CHECK-NEXT: DW_MACRO_define_strx - lineno: 1 macro: FOO 5
; CHECK-NEXT: DW_MACRO_end_file
; CHECK-NEXT: DW_MACRO_start_file - lineno: 2 filenum: 2
-; CHECK-NEXT: DW_MACRO_undef_strp - lineno: 14 macro: YEA
+; CHECK-NEXT: DW_MACRO_undef_strx - lineno: 14 macro: YEA
; CHECK-NEXT: DW_MACRO_end_file
-; CHECK-NEXT: DW_MACRO_undef_strp - lineno: 14 macro: YEA
+; CHECK-NEXT: DW_MACRO_undef_strx - lineno: 14 macro: YEA
; CHECK-NEXT: DW_MACRO_end_file
; ModuleID = 'test.c'
Index: llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -2911,26 +2911,23 @@
if (UseMacro) {
unsigned Type = M.getMacinfoType() == dwarf::DW_MACINFO_define
- ? dwarf::DW_MACRO_define_strp
- : dwarf::DW_MACRO_undef_strp;
+ ? dwarf::DW_MACRO_define_strx
+ : dwarf::DW_MACRO_undef_strx;
Asm->OutStreamer->AddComment(dwarf::MacroString(Type));
Asm->emitULEB128(Type);
Asm->OutStreamer->AddComment("Line Number");
Asm->emitULEB128(M.getLine());
Asm->OutStreamer->AddComment("Macro String");
if (!Value.empty())
- Asm->OutStreamer->emitSymbolValue(
- this->InfoHolder.getStringPool()
- .getEntry(*Asm, (Name + " " + Value).str())
- .getSymbol(),
- 4);
+ Asm->emitULEB128(this->InfoHolder.getStringPool()
+ .getIndexedEntry(*Asm, (Name + " " + Value).str())
+ .getIndex());
else
- // DW_MACRO_undef_strp doesn't have a value, so just emit the macro
+ // DW_MACRO_undef_strx doesn't have a value, so just emit the macro
// string.
- Asm->OutStreamer->emitSymbolValue(this->InfoHolder.getStringPool()
- .getEntry(*Asm, (Name).str())
- .getSymbol(),
- 4);
+ Asm->emitULEB128(this->InfoHolder.getStringPool()
+ .getIndexedEntry(*Asm, (Name).str())
+ .getIndex());
} else {
Asm->OutStreamer->AddComment(dwarf::MacinfoString(M.getMacinfoType()));
Asm->emitULEB128(M.getMacinfoType());
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D78865.260118.patch
Type: text/x-patch
Size: 2892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200425/259b67fb/attachment.bin>
More information about the llvm-commits
mailing list