From ed3277ab496555fcf7cd449d1e1da01618d764ed Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Wed, 22 Jan 2020 11:03:49 -0800 Subject: DWARF: Use end_sequence and copy properly (#2610) We need to track end_sequence directly, and use either end_sequence or copy (copy emits a line without marking it as ending a sequence). After this, fib2 debug line output looks perfect. --- src/wasm/wasm-debug.cpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/wasm/wasm-debug.cpp b/src/wasm/wasm-debug.cpp index e0464db0c..3a683e11c 100644 --- a/src/wasm/wasm-debug.cpp +++ b/src/wasm/wasm-debug.cpp @@ -121,6 +121,7 @@ struct LineState { // XXX these two should be just prologue, epilogue? bool prologueEnd = false; bool epilogueBegin = false; + bool endSequence = false; LineState(const LineState& other) = default; LineState(const llvm::DWARFYAML::LineTable& table) @@ -140,6 +141,7 @@ struct LineState { break; } case llvm::dwarf::DW_LNE_end_sequence: { + endSequence = true; return true; } case llvm::dwarf::DW_LNE_set_discriminator: { @@ -299,14 +301,18 @@ struct LineState { Fatal() << "eb"; } if (useSpecial) { - // Emit a special, which ends a sequence automatically. + // Emit a special, which emits a line automatically. // TODO } else { - // End the sequence manually. - // len = 1 (subopcode) - newOpcodes.push_back(makeItem(llvm::dwarf::DW_LNE_end_sequence, 1)); - // Reset the state. - *this = LineState(table); + // Emit the line manually. + if (endSequence) { + // len = 1 (subopcode) + newOpcodes.push_back(makeItem(llvm::dwarf::DW_LNE_end_sequence, 1)); + // Reset the state. + *this = LineState(table); + } else { + newOpcodes.push_back(makeItem(llvm::dwarf::DW_LNS_copy)); + } } } -- cgit v1.2.3