OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/inspector/v8-stack-trace-impl.h" | 5 #include "src/inspector/v8-stack-trace-impl.h" |
6 | 6 |
7 #include "src/inspector/string-util.h" | 7 #include "src/inspector/string-util.h" |
8 #include "src/inspector/v8-debugger-agent-impl.h" | 8 #include "src/inspector/v8-debugger-agent-impl.h" |
9 #include "src/inspector/v8-debugger.h" | 9 #include "src/inspector/v8-debugger.h" |
10 #include "src/inspector/v8-inspector-impl.h" | 10 #include "src/inspector/v8-inspector-impl.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 String16 functionName; | 34 String16 functionName; |
35 v8::Local<v8::String> functionNameValue(frame->GetFunctionName()); | 35 v8::Local<v8::String> functionNameValue(frame->GetFunctionName()); |
36 if (!functionNameValue.IsEmpty()) | 36 if (!functionNameValue.IsEmpty()) |
37 functionName = toProtocolString(functionNameValue); | 37 functionName = toProtocolString(functionNameValue); |
38 | 38 |
39 int sourceLineNumber = frame->GetLineNumber() - 1; | 39 int sourceLineNumber = frame->GetLineNumber() - 1; |
40 int sourceColumn = frame->GetColumn() - 1; | 40 int sourceColumn = frame->GetColumn() - 1; |
41 // TODO(clemensh): Figure out a way to do this translation only right before | 41 // TODO(clemensh): Figure out a way to do this translation only right before |
42 // sending the stack trace over wire. | 42 // sending the stack trace over wire. |
43 wasmTranslation->TranslateWasmScriptLocationToProtocolLocation( | 43 if (frame->IsWasm()) { |
44 &scriptId, &sourceLineNumber, &sourceColumn); | 44 wasmTranslation->TranslateWasmScriptLocationToProtocolLocation( |
| 45 &scriptId, &sourceLineNumber, &sourceColumn); |
| 46 } |
45 return V8StackTraceImpl::Frame(functionName, scriptId, sourceName, | 47 return V8StackTraceImpl::Frame(functionName, scriptId, sourceName, |
46 sourceLineNumber + 1, sourceColumn + 1); | 48 sourceLineNumber + 1, sourceColumn + 1); |
47 } | 49 } |
48 | 50 |
49 void toFramesVector(v8::Local<v8::StackTrace> stackTrace, | 51 void toFramesVector(v8::Local<v8::StackTrace> stackTrace, |
50 std::vector<V8StackTraceImpl::Frame>& frames, | 52 std::vector<V8StackTraceImpl::Frame>& frames, |
51 size_t maxStackSize, v8::Isolate* isolate, | 53 size_t maxStackSize, v8::Isolate* isolate, |
52 V8Debugger* debugger, int contextGroupId) { | 54 V8Debugger* debugger, int contextGroupId) { |
53 DCHECK(isolate->InContext()); | 55 DCHECK(isolate->InContext()); |
54 int frameCount = stackTrace->GetFrameCount(); | 56 int frameCount = stackTrace->GetFrameCount(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 stackTrace.append(String16::fromInteger(frame.lineNumber())); | 301 stackTrace.append(String16::fromInteger(frame.lineNumber())); |
300 stackTrace.append(':'); | 302 stackTrace.append(':'); |
301 stackTrace.append(String16::fromInteger(frame.columnNumber())); | 303 stackTrace.append(String16::fromInteger(frame.columnNumber())); |
302 stackTrace.append(')'); | 304 stackTrace.append(')'); |
303 } | 305 } |
304 String16 string = stackTrace.toString(); | 306 String16 string = stackTrace.toString(); |
305 return StringBufferImpl::adopt(string); | 307 return StringBufferImpl::adopt(string); |
306 } | 308 } |
307 | 309 |
308 } // namespace v8_inspector | 310 } // namespace v8_inspector |
OLD | NEW |