1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-28 21:02:07 +00:00

LibJS: Add file & line number to bytecode VM stack traces :^)

This works by adding source start/end offset to every bytecode
instruction. In the future we can make this more efficient by keeping
a map of bytecode ranges to source ranges in the Executable instead,
but let's just get traces working first.

Co-Authored-By: Andrew Kaster <akaster@serenityos.org>
This commit is contained in:
Andreas Kling 2023-09-01 16:53:55 +02:00
parent 0b66656ca9
commit 1c06111cbd
16 changed files with 157 additions and 26 deletions

View file

@ -87,7 +87,7 @@ public:
Executable& current_executable() { return *m_current_executable; }
Executable const& current_executable() const { return *m_current_executable; }
BasicBlock const& current_block() const { return *m_current_block; }
size_t pc() const;
auto& instruction_stream_iterator() const { return m_pc; }
DeprecatedString debug_position() const;
Optional<Value>& this_value() { return m_this_value; }
@ -121,7 +121,7 @@ private:
Optional<Value> m_saved_exception;
Executable* m_current_executable { nullptr };
BasicBlock const* m_current_block { nullptr };
InstructionStreamIterator* m_pc { nullptr };
Optional<InstructionStreamIterator&> m_pc {};
};
extern bool g_dump_bytecode;