From cd7dbe3e972324021814fc968735488564ca4072 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 11 Sep 2021 17:01:19 +0200 Subject: LibJS: Include source locations in VM::dump_backtrace() output --- Userland/Libraries/LibJS/Runtime/VM.cpp | 11 +++++++++-- 1 file 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 -- cgit v1.2.3