diff options
author | Alon Zakai <azakai@google.com> | 2020-01-22 11:03:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-22 11:03:49 -0800 |
commit | ed3277ab496555fcf7cd449d1e1da01618d764ed (patch) | |
tree | 942f1f48dc0f0f4dd50dc3e3b71f1f7cd824fe9e /src | |
parent | 3fbe9423fcadf1b71eb45143f18dc994fb7c69e1 (diff) | |
download | binaryen-ed3277ab496555fcf7cd449d1e1da01618d764ed.tar.gz binaryen-ed3277ab496555fcf7cd449d1e1da01618d764ed.tar.bz2 binaryen-ed3277ab496555fcf7cd449d1e1da01618d764ed.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-debug.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
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)); + } } } |