mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-27 19:59:17 +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:
@@ -268,8 +268,13 @@ static ErrorOr<bool> parse_and_run(JS::Realm& realm, StringView source, StringVi
|
||||
warnln(" -> {}", traceback_frame.function_name);
|
||||
warnln(" {} more calls", repetitions);
|
||||
} else {
|
||||
for (size_t j = 0; j < repetitions + 1; ++j)
|
||||
warnln(" -> {}", traceback_frame.function_name);
|
||||
for (size_t j = 0; j < repetitions + 1; ++j) {
|
||||
warnln(" -> {} ({}:{},{})",
|
||||
traceback_frame.function_name,
|
||||
traceback_frame.source_range().code->filename(),
|
||||
traceback_frame.source_range().start.line,
|
||||
traceback_frame.source_range().start.column);
|
||||
}
|
||||
}
|
||||
repetitions = 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user