summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-11 17:01:19 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-11 17:01:19 +0200
commitcd7dbe3e972324021814fc968735488564ca4072 (patch)
tree8a4389fe26b215175f8bf4fc2a823e337f3b811b
parentca940d72402f5edcb089d64502811ed8cb64c2bc (diff)
downloadserenity-cd7dbe3e972324021814fc968735488564ca4072.zip
LibJS: Include source locations in VM::dump_backtrace() output
-rw-r--r--Userland/Libraries/LibJS/Runtime/VM.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/VM.cpp b/Userland/Libraries/LibJS/Runtime/VM.cpp
index 28be8eaed0..c4d332b3fb 100644
--- a/Userland/Libraries/LibJS/Runtime/VM.cpp
+++ b/Userland/Libraries/LibJS/Runtime/VM.cpp
@@ -757,8 +757,15 @@ void VM::promise_rejection_tracker(const Promise& promise, Promise::RejectionOpe
void VM::dump_backtrace() const
{
- for (ssize_t i = m_execution_context_stack.size() - 1; i >= 0; --i)
- dbgln("-> {}", m_execution_context_stack[i]->function_name);
+ for (ssize_t i = m_execution_context_stack.size() - 1; i >= 0; --i) {
+ auto& frame = m_execution_context_stack[i];
+ if (frame->current_node) {
+ auto& source_range = frame->current_node->source_range();
+ dbgln("-> {} @ {}:{},{}", frame->function_name, source_range.filename, source_range.start.line, source_range.start.column);
+ } else {
+ dbgln("-> {}", frame->function_name);
+ }
+ }
}
void VM::dump_environment_chain() const