| Index: src/inspector/v8-stack-trace-impl.cc
|
| diff --git a/src/inspector/v8-stack-trace-impl.cc b/src/inspector/v8-stack-trace-impl.cc
|
| index 1a38c6dd82a002b11db462beb6c6ef07e5f9f61f..18db231855f8964a7fc2423f5ab7ca7a8ba3e23b 100644
|
| --- a/src/inspector/v8-stack-trace-impl.cc
|
| +++ b/src/inspector/v8-stack-trace-impl.cc
|
| @@ -5,6 +5,7 @@
|
| #include "src/inspector/v8-stack-trace-impl.h"
|
|
|
| #include "src/inspector/string-util.h"
|
| +#include "src/inspector/v8-debugger-agent-impl.h"
|
| #include "src/inspector/v8-debugger.h"
|
| #include "src/inspector/v8-inspector-impl.h"
|
| #include "src/inspector/v8-profiler-agent-impl.h"
|
| @@ -23,7 +24,8 @@ static const v8::StackTrace::StackTraceOptions stackTraceOptions =
|
| v8::StackTrace::kScriptId | v8::StackTrace::kScriptNameOrSourceURL |
|
| v8::StackTrace::kFunctionName);
|
|
|
| -V8StackTraceImpl::Frame toFrame(v8::Local<v8::StackFrame> frame) {
|
| +V8StackTraceImpl::Frame toFrame(V8DebuggerAgentImpl* agent,
|
| + v8::Local<v8::StackFrame> frame) {
|
| String16 scriptId = String16::fromInteger(frame->GetScriptId());
|
| String16 sourceName;
|
| v8::Local<v8::String> sourceNameValue(frame->GetScriptNameOrSourceURL());
|
| @@ -35,13 +37,16 @@ V8StackTraceImpl::Frame toFrame(v8::Local<v8::StackFrame> frame) {
|
| if (!functionNameValue.IsEmpty())
|
| functionName = toProtocolString(functionNameValue);
|
|
|
| - int sourceLineNumber = frame->GetLineNumber();
|
| - int sourceColumn = frame->GetColumn();
|
| + int sourceLineNumber = frame->GetLineNumber() - 1;
|
| + int sourceColumn = frame->GetColumn() - 1;
|
| + if (agent)
|
| + agent->translateLocation(&scriptId, &sourceLineNumber, &sourceColumn);
|
| return V8StackTraceImpl::Frame(functionName, scriptId, sourceName,
|
| - sourceLineNumber, sourceColumn);
|
| + sourceLineNumber + 1, sourceColumn + 1);
|
| }
|
|
|
| -void toFramesVector(v8::Local<v8::StackTrace> stackTrace,
|
| +void toFramesVector(V8DebuggerAgentImpl* agent,
|
| + v8::Local<v8::StackTrace> stackTrace,
|
| std::vector<V8StackTraceImpl::Frame>& frames,
|
| size_t maxStackSize, v8::Isolate* isolate) {
|
| DCHECK(isolate->InContext());
|
| @@ -50,7 +55,7 @@ void toFramesVector(v8::Local<v8::StackTrace> stackTrace,
|
| frameCount = static_cast<int>(maxStackSize);
|
| for (int i = 0; i < frameCount; i++) {
|
| v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i);
|
| - frames.push_back(toFrame(stackFrame));
|
| + frames.push_back(toFrame(agent, stackFrame));
|
| }
|
| }
|
|
|
| @@ -112,8 +117,12 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create(
|
| v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
| v8::HandleScope scope(isolate);
|
| std::vector<V8StackTraceImpl::Frame> frames;
|
| + V8DebuggerAgentImpl* agent =
|
| + debugger
|
| + ? debugger->inspector()->enabledDebuggerAgentForGroup(contextGroupId)
|
| + : nullptr;
|
| if (!stackTrace.IsEmpty())
|
| - toFramesVector(stackTrace, frames, maxStackSize, isolate);
|
| + toFramesVector(agent, stackTrace, frames, maxStackSize, isolate);
|
|
|
| int maxAsyncCallChainDepth = 1;
|
| V8StackTraceImpl* asyncCallChain = nullptr;
|
|
|