From eae2ee3dff0c68cfa783f45ee3ced06f4b5aa47c Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 24 Jun 2020 12:55:15 -0700 Subject: DWARF: Fix sequence_end emitting (#2929) We must emit those, even if otherwise it looks like a line we can omit, as the ends of sequences have important meaning and dwarfdump will warn without them. Looks like fannkuch0 in the test suite already had an example of an incorrectly-omitted sequence_end, so no need for a new testcase. Verified that without this e.g. wasm2.test_exceptions with -g added will lead to a wasm that warns, but with this PR the debug_line section is reported as valid by dwarfdump. --- src/wasm/wasm-debug.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/wasm') diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp index 8ae7497ed..20c5dfb62 100644 --- a/src/wasm/wasm-debug.cpp +++ b/src/wasm/wasm-debug.cpp @@ -241,9 +241,10 @@ struct LineState { } bool needToEmit() { - // Zero values imply we can ignore this line. + // Zero values imply we can ignore this line, unless it has something + // special we must emit. // https://github.com/WebAssembly/debugging/issues/9#issuecomment-567720872 - return line != 0 && addr != 0; + return (line != 0 && addr != 0) || endSequence; } // Given an old state, emit the diff from it to this state into a new line -- cgit v1.2.3