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 e1eb59ec22f05490de1d23bf6df97d8da71963a2..c5ed579f3fd481e3b6d3a6968961ca6735ac68bb 100644 |
--- a/src/inspector/v8-stack-trace-impl.cc |
+++ b/src/inspector/v8-stack-trace-impl.cc |
@@ -43,12 +43,13 @@ V8StackTraceImpl::Frame toFrame(v8::Local<v8::StackFrame> frame) { |
void toFramesVector(v8::Local<v8::StackTrace> stackTrace, |
std::vector<V8StackTraceImpl::Frame>& frames, |
- size_t maxStackSize, v8::Isolate* isolate) { |
+ size_t maxStackSize, v8::Isolate* isolate, |
+ bool skipInitialFrame) { |
DCHECK(isolate->InContext()); |
int frameCount = stackTrace->GetFrameCount(); |
if (frameCount > static_cast<int>(maxStackSize)) |
frameCount = static_cast<int>(maxStackSize); |
- for (int i = 0; i < frameCount; i++) { |
+ for (int i = skipInitialFrame ? 1 : 0; i < frameCount; i++) { |
v8::Local<v8::StackFrame> stackFrame = stackTrace->GetFrame(i); |
frames.push_back(toFrame(stackFrame)); |
} |
@@ -108,12 +109,12 @@ void V8StackTraceImpl::setCaptureStackTraceForUncaughtExceptions( |
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create( |
V8Debugger* debugger, int contextGroupId, |
v8::Local<v8::StackTrace> stackTrace, size_t maxStackSize, |
- const String16& description) { |
+ const String16& description, bool skipInitialFrame) { |
v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
v8::HandleScope scope(isolate); |
std::vector<V8StackTraceImpl::Frame> frames; |
if (!stackTrace.IsEmpty()) |
- toFramesVector(stackTrace, frames, maxStackSize, isolate); |
+ toFramesVector(stackTrace, frames, maxStackSize, isolate, skipInitialFrame); |
int maxAsyncCallChainDepth = 1; |
V8StackTraceImpl* asyncCallChain = nullptr; |
@@ -153,9 +154,10 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::create( |
return result; |
} |
+// static |
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( |
V8Debugger* debugger, int contextGroupId, size_t maxStackSize, |
- const String16& description) { |
+ const String16& description, bool skipInitialFrame) { |
v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
v8::HandleScope handleScope(isolate); |
v8::Local<v8::StackTrace> stackTrace; |
@@ -170,7 +172,7 @@ std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::capture( |
isolate, static_cast<int>(maxStackSize), stackTraceOptions); |
} |
return V8StackTraceImpl::create(debugger, contextGroupId, stackTrace, |
- maxStackSize, description); |
+ maxStackSize, description, skipInitialFrame); |
} |
std::unique_ptr<V8StackTraceImpl> V8StackTraceImpl::cloneImpl() { |