summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/passes/Print.cpp5
-rw-r--r--test/fib-dbg.wasm.fromBinary5
2 files changed, 9 insertions, 1 deletions
diff --git a/src/passes/Print.cpp b/src/passes/Print.cpp
index 7f06f8c17..3ae7b6899 100644
--- a/src/passes/Print.cpp
+++ b/src/passes/Print.cpp
@@ -170,6 +170,8 @@ struct PrintSExpression : public UnifiedExpressionVisitor<PrintSExpression> {
std::vector<HeapType> heapTypes;
+ unsigned lastPrintIndent = 0;
+
// Print type names by saved name or index if we have a module, or otherwise
// by generating minimalist names. TODO: Handle conflicts between
// user-provided names and the fallback indexed names.
@@ -2375,10 +2377,11 @@ std::ostream& PrintSExpression::printPrefixedTypes(const char* prefix,
void PrintSExpression::printDebugLocation(
const Function::DebugLocation& location) {
- if (lastPrintedLocation == location) {
+ if (lastPrintedLocation == location && indent > lastPrintIndent) {
return;
}
lastPrintedLocation = location;
+ lastPrintIndent = indent;
auto fileName = currModule->debugInfoFileNames[location.fileIndex];
o << ";;@ " << fileName << ":" << location.lineNumber << ":"
<< location.columnNumber << '\n';
diff --git a/test/fib-dbg.wasm.fromBinary b/test/fib-dbg.wasm.fromBinary
index 3cfa1bc66..f36bd2250 100644
--- a/test/fib-dbg.wasm.fromBinary
+++ b/test/fib-dbg.wasm.fromBinary
@@ -133,6 +133,7 @@
(i32.const 0)
)
)
+ ;;@ fib.c:3:0
(if
(local.get $6)
(block
@@ -156,6 +157,7 @@
)
)
)
+ ;;@ fib.c:8:0
(loop $label$4
(block $label$5
;;@ fib.c:4:0
@@ -172,12 +174,14 @@
(i32.const 1)
)
)
+ ;;@ fib.c:3:0
(local.set $7
(i32.eq
(local.get $9)
(local.get $0)
)
)
+ ;;@ fib.c:3:0
(if
(local.get $7)
(block
@@ -201,6 +205,7 @@
)
)
)
+ ;;@ fib.c:3:0
(br $label$4)
)
)