From d58c54643eb97e5c35f8c14a38f3bf549aee92f4 Mon Sep 17 00:00:00 2001 From: Jérôme Vouillon Date: Thu, 2 May 2024 14:09:15 -0400 Subject: Source map fixes (#6550) * Keep debug locations at function start The `fn_prolog_epilog.debugInfo` test is failing otherwise, since there was debug information associated to the nop instruction at the beginning of the function. * Do not clear the debug information when reaching the end of the source map The last segment should extend to the end of the function. * Propagate debug location from the function prolog to its first instruction * Fix printing of epilogue location The text parser no longer propagates locations to the epilogue, so we should always print the location if there is one. * Fix debug location smearing The debug location of the last instruction should not smear into the function epilogue, and a debug location from a previous function should not smear into the prologue of the current function. --- src/wasm/wasm-stack.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/wasm/wasm-stack.cpp') diff --git a/src/wasm/wasm-stack.cpp b/src/wasm/wasm-stack.cpp index 99aaf517e..dda47ffa6 100644 --- a/src/wasm/wasm-stack.cpp +++ b/src/wasm/wasm-stack.cpp @@ -2839,8 +2839,13 @@ void StackIRToBinaryWriter::write() { WASM_UNREACHABLE("unexpected op"); } } + // Indicate the debug location corresponding to the end opcode that + // terminates the function code. if (func->epilogLocation.size()) { parent.writeDebugLocation(*func->epilogLocation.begin()); + } else { + // The end opcode has no debug location. + parent.writeNoDebugLocation(); } writer.emitFunctionEnd(); } -- cgit v1.2.3