diff options
-rw-r--r-- | src/wasm/wasm-debug.cpp | 2 | ||||
-rw-r--r-- | test/passes/dwarf_unit_with_no_abbrevs_noprint.bin.txt | 0 | ||||
-rw-r--r-- | test/passes/dwarf_unit_with_no_abbrevs_noprint.passes | 1 | ||||
-rw-r--r-- | test/passes/dwarf_unit_with_no_abbrevs_noprint.wasm | bin | 0 -> 90489 bytes | |||
-rw-r--r-- | third_party/llvm-project/DWARFVisitor.cpp | 5 |
5 files changed, 7 insertions, 1 deletions
diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp index 50a04a6e6..286b63e69 100644 --- a/src/wasm/wasm-debug.cpp +++ b/src/wasm/wasm-debug.cpp @@ -56,7 +56,7 @@ struct BinaryenDWARFInfo { BinaryenDWARFInfo(const Module& wasm) { // Get debug sections from the wasm. for (auto& section : wasm.userSections) { - if (Name(section.name).startsWith(".debug_")) { + if (Name(section.name).startsWith(".debug_") && section.data.data()) { // TODO: efficiency sections[section.name.substr(1)] = llvm::MemoryBuffer::getMemBufferCopy( llvm::StringRef(section.data.data(), section.data.size())); diff --git a/test/passes/dwarf_unit_with_no_abbrevs_noprint.bin.txt b/test/passes/dwarf_unit_with_no_abbrevs_noprint.bin.txt new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/passes/dwarf_unit_with_no_abbrevs_noprint.bin.txt diff --git a/test/passes/dwarf_unit_with_no_abbrevs_noprint.passes b/test/passes/dwarf_unit_with_no_abbrevs_noprint.passes new file mode 100644 index 000000000..48ea00769 --- /dev/null +++ b/test/passes/dwarf_unit_with_no_abbrevs_noprint.passes @@ -0,0 +1 @@ +roundtrip_g diff --git a/test/passes/dwarf_unit_with_no_abbrevs_noprint.wasm b/test/passes/dwarf_unit_with_no_abbrevs_noprint.wasm Binary files differnew file mode 100644 index 000000000..bf50db775 --- /dev/null +++ b/test/passes/dwarf_unit_with_no_abbrevs_noprint.wasm diff --git a/third_party/llvm-project/DWARFVisitor.cpp b/third_party/llvm-project/DWARFVisitor.cpp index 44bb33b47..ba3d1e0c5 100644 --- a/third_party/llvm-project/DWARFVisitor.cpp +++ b/third_party/llvm-project/DWARFVisitor.cpp @@ -59,6 +59,11 @@ template <typename T> void DWARFYAML::VisitorImpl<T>::traverseDebugInfo() { DebugInfo.AbbrevDecls[AbbrevEnd].Code) { AbbrevEnd++; } + // XXX BINARYEN If there are no abbreviations, there is nothing to + // do in this unit. + if (AbbrevStart == AbbrevEnd) { + continue; + } onStartCompileUnit(Unit); if (Unit.Entries.empty()) { // XXX BINARYEN continue; |