[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 01:36:03 PDT 2020


Higuoxing updated this revision to Diff 290663.
Higuoxing marked 2 inline comments as done.
Higuoxing added a comment.

Address review comments.

Thanks!


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 that its name is not recognized by obj2yaml.
+
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s --check-prefix=UNRECOGNIZED
+
+#      UNRECOGNIZED: Sections:
+# UNRECOGNIZED-NEXT:   - Name:    .debug_foo
+# UNRECOGNIZED-NEXT:     Type:    SHT_PROGBITS
+# UNRECOGNIZED-NEXT:     Content: '01020304'
+# UNRECOGNIZED-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.290663.patch
Type: text/x-patch
Size: 1310 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/2a7119e3/attachment.bin>


More information about the llvm-commits mailing list