Skip to content

Commit 3eea535

Browse files
authored
initialize binary writer debug info even without a source map, as debug info may exist without a source map (WebAssembly#1733)
1 parent 9f49e3d commit 3eea535

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

src/wasm-binary.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -721,6 +721,7 @@ class WasmBinaryWriter {
721721
void writeLateUserSections();
722722
void writeUserSection(const UserSection& section);
723723

724+
void initializeDebugInfo();
724725
void writeSourceMapProlog();
725726
void writeSourceMapEpilog();
726727
void writeDebugLocation(const Function::DebugLocation& loc);

src/wasm/wasm-binary.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ void WasmBinaryWriter::write() {
4444

4545
writeEarlyUserSections();
4646

47+
initializeDebugInfo();
4748
if (sourceMap) {
4849
writeSourceMapProlog();
4950
}
@@ -484,8 +485,11 @@ void WasmBinaryWriter::writeSymbolMap() {
484485
file.close();
485486
}
486487

487-
void WasmBinaryWriter::writeSourceMapProlog() {
488+
void WasmBinaryWriter::initializeDebugInfo() {
488489
lastDebugLocation = { 0, /* lineNumber = */ 1, 0 };
490+
}
491+
492+
void WasmBinaryWriter::writeSourceMapProlog() {
489493
*sourceMap << "{\"version\":3,\"sources\":[";
490494
for (size_t i = 0; i < wasm->debugInfoFileNames.size(); i++) {
491495
if (i > 0) *sourceMap << ",";

0 commit comments

Comments
 (0)