[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 05:08:08 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG25f3cc0ced17: [elf2yaml] Fix dumping a debug section whose name is not recognized. (authored by Higuoxing).

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.290717.patch
Type: text/x-patch
Size: 1247 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200909/e08939e5/attachment.bin>


More information about the llvm-commits mailing list