[PATCH] D87346: [elf2yaml] Fix dumping a debug section whose name is not recognized.
Xing GUO via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 9 03:07:58 PDT 2020
Higuoxing updated this revision to Diff 290682.
Higuoxing marked 2 inline comments as done.
Higuoxing added a comment.
Address review comments.
Thanks for reviewing!
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D87346/new/
https://reviews.llvm.org/D87346
Files:
llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml
llvm/tools/obj2yaml/elf2yaml.cpp
Index: llvm/tools/obj2yaml/elf2yaml.cpp
===================================================================
--- llvm/tools/obj2yaml/elf2yaml.cpp
+++ llvm/tools/obj2yaml/elf2yaml.cpp
@@ -416,6 +416,8 @@
Err = dumpDebugARanges(*DWARFCtx.get(), DWARF);
else if (RawSec->Name == ".debug_str")
Err = dumpDebugStrings(*DWARFCtx.get(), DWARF);
+ else
+ continue;
// If the DWARF section cannot be successfully parsed, emit raw content
// instead of an entry in the DWARF section of the YAML.
Index: llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml
===================================================================
--- /dev/null
+++ llvm/test/tools/obj2yaml/ELF/DWARF/unrecognized-debug-section.yaml
@@ -0,0 +1,19 @@
+## Test dumping a debug section when its name is not recognized by obj2yaml.
+
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+# CHECK: Sections:
+# CHECK-NEXT: - Name: .debug_foo
+# CHECK-NEXT: Type: SHT_PROGBITS
+# CHECK-NEXT: Content: '01020304'
+# CHECK-NEXT: ...
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_EXEC
+Sections:
+ - Name: .debug_foo
+ Type: SHT_PROGBITS
+ Content: '01020304'
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87346.290682.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/09472f9d/attachment-0001.bin>
More information about the llvm-commits
mailing list