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-debugger.h" | 5 #include "src/inspector/v8-debugger.h" |
6 | 6 |
7 #include "src/inspector/debugger-script.h" | 7 #include "src/inspector/debugger-script.h" |
8 #include "src/inspector/protocol/Protocol.h" | 8 #include "src/inspector/protocol/Protocol.h" |
9 #include "src/inspector/script-breakpoint.h" | 9 #include "src/inspector/script-breakpoint.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 } | 419 } |
420 return true; | 420 return true; |
421 } | 421 } |
422 // Compile error. | 422 // Compile error. |
423 case 1: { | 423 case 1: { |
424 *exceptionDetails = | 424 *exceptionDetails = |
425 protocol::Runtime::ExceptionDetails::create() | 425 protocol::Runtime::ExceptionDetails::create() |
426 .setExceptionId(m_inspector->nextExceptionId()) | 426 .setExceptionId(m_inspector->nextExceptionId()) |
427 .setText(toProtocolStringWithTypeCheck( | 427 .setText(toProtocolStringWithTypeCheck( |
428 resultTuple->Get(context, 2).ToLocalChecked())) | 428 resultTuple->Get(context, 2).ToLocalChecked())) |
429 .setLineNumber(resultTuple->Get(context, 3) | 429 .setLineNumber(static_cast<int>(resultTuple->Get(context, 3) |
430 .ToLocalChecked() | 430 .ToLocalChecked() |
431 ->ToInteger(context) | 431 ->ToInteger(context) |
432 .ToLocalChecked() | 432 .ToLocalChecked() |
433 ->Value() - | 433 ->Value()) - |
434 1) | 434 1) |
435 .setColumnNumber(resultTuple->Get(context, 4) | 435 .setColumnNumber(static_cast<int>(resultTuple->Get(context, 4) |
436 .ToLocalChecked() | 436 .ToLocalChecked() |
437 ->ToInteger(context) | 437 ->ToInteger(context) |
438 .ToLocalChecked() | 438 .ToLocalChecked() |
439 ->Value() - | 439 ->Value()) - |
440 1) | 440 1) |
441 .build(); | 441 .build(); |
442 return false; | 442 return false; |
443 } | 443 } |
444 } | 444 } |
445 *error = "Unknown error."; | 445 *error = "Unknown error."; |
446 return false; | 446 return false; |
447 } | 447 } |
448 | 448 |
449 JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { | 449 JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { |
(...skipping 14 matching lines...) Expand all Loading... |
464 v8::Local<v8::Value> argv[] = {m_executionState, | 464 v8::Local<v8::Value> argv[] = {m_executionState, |
465 v8::Integer::New(m_isolate, limit)}; | 465 v8::Integer::New(m_isolate, limit)}; |
466 currentCallFramesV8 = | 466 currentCallFramesV8 = |
467 callDebuggerMethod("currentCallFrames", arraysize(argv), argv) | 467 callDebuggerMethod("currentCallFrames", arraysize(argv), argv) |
468 .ToLocalChecked(); | 468 .ToLocalChecked(); |
469 } | 469 } |
470 DCHECK(!currentCallFramesV8.IsEmpty()); | 470 DCHECK(!currentCallFramesV8.IsEmpty()); |
471 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); | 471 if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); |
472 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); | 472 v8::Local<v8::Array> callFramesArray = currentCallFramesV8.As<v8::Array>(); |
473 JavaScriptCallFrames callFrames; | 473 JavaScriptCallFrames callFrames; |
474 for (size_t i = 0; i < callFramesArray->Length(); ++i) { | 474 for (uint32_t i = 0; i < callFramesArray->Length(); ++i) { |
475 v8::Local<v8::Value> callFrameValue; | 475 v8::Local<v8::Value> callFrameValue; |
476 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) | 476 if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) |
477 return JavaScriptCallFrames(); | 477 return JavaScriptCallFrames(); |
478 if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); | 478 if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); |
479 v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); | 479 v8::Local<v8::Object> callFrameObject = callFrameValue.As<v8::Object>(); |
480 callFrames.push_back(JavaScriptCallFrame::create( | 480 callFrames.push_back(JavaScriptCallFrame::create( |
481 debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); | 481 debuggerContext(), v8::Local<v8::Object>::Cast(callFrameObject))); |
482 } | 482 } |
483 return callFrames; | 483 return callFrames; |
484 } | 484 } |
(...skipping 25 matching lines...) Expand all Loading... |
510 // Don't allow nested breaks. | 510 // Don't allow nested breaks. |
511 if (m_runningNestedMessageLoop) return; | 511 if (m_runningNestedMessageLoop) return; |
512 | 512 |
513 V8DebuggerAgentImpl* agent = | 513 V8DebuggerAgentImpl* agent = |
514 m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); | 514 m_inspector->enabledDebuggerAgentForGroup(getGroupId(pausedContext)); |
515 if (!agent) return; | 515 if (!agent) return; |
516 | 516 |
517 std::vector<String16> breakpointIds; | 517 std::vector<String16> breakpointIds; |
518 if (!hitBreakpointNumbers.IsEmpty()) { | 518 if (!hitBreakpointNumbers.IsEmpty()) { |
519 breakpointIds.reserve(hitBreakpointNumbers->Length()); | 519 breakpointIds.reserve(hitBreakpointNumbers->Length()); |
520 for (size_t i = 0; i < hitBreakpointNumbers->Length(); i++) { | 520 for (uint32_t i = 0; i < hitBreakpointNumbers->Length(); i++) { |
521 v8::Local<v8::Value> hitBreakpointNumber = | 521 v8::Local<v8::Value> hitBreakpointNumber = |
522 hitBreakpointNumbers->Get(debuggerContext(), i).ToLocalChecked(); | 522 hitBreakpointNumbers->Get(debuggerContext(), i).ToLocalChecked(); |
523 DCHECK(hitBreakpointNumber->IsInt32()); | 523 DCHECK(hitBreakpointNumber->IsInt32()); |
524 breakpointIds.push_back(String16::fromInteger( | 524 breakpointIds.push_back(String16::fromInteger( |
525 hitBreakpointNumber->Int32Value(debuggerContext()).FromJust())); | 525 hitBreakpointNumber->Int32Value(debuggerContext()).FromJust())); |
526 } | 526 } |
527 } | 527 } |
528 | 528 |
529 m_pausedContext = pausedContext; | 529 m_pausedContext = pausedContext; |
530 m_executionState = executionState; | 530 m_executionState = executionState; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 636 |
637 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, | 637 void V8Debugger::handleV8AsyncTaskEvent(v8::Local<v8::Context> context, |
638 v8::Local<v8::Object> executionState, | 638 v8::Local<v8::Object> executionState, |
639 v8::Local<v8::Object> eventData) { | 639 v8::Local<v8::Object> eventData) { |
640 if (!m_maxAsyncCallStackDepth) return; | 640 if (!m_maxAsyncCallStackDepth) return; |
641 | 641 |
642 String16 type = toProtocolStringWithTypeCheck( | 642 String16 type = toProtocolStringWithTypeCheck( |
643 callInternalGetterFunction(eventData, "type")); | 643 callInternalGetterFunction(eventData, "type")); |
644 String16 name = toProtocolStringWithTypeCheck( | 644 String16 name = toProtocolStringWithTypeCheck( |
645 callInternalGetterFunction(eventData, "name")); | 645 callInternalGetterFunction(eventData, "name")); |
646 int id = callInternalGetterFunction(eventData, "id") | 646 int id = static_cast<int>(callInternalGetterFunction(eventData, "id") |
647 ->ToInteger(context) | 647 ->ToInteger(context) |
648 .ToLocalChecked() | 648 .ToLocalChecked() |
649 ->Value(); | 649 ->Value()); |
650 // Async task events from Promises are given misaligned pointers to prevent | 650 // Async task events from Promises are given misaligned pointers to prevent |
651 // from overlapping with other Blink task identifiers. There is a single | 651 // from overlapping with other Blink task identifiers. There is a single |
652 // namespace of such ids, managed by src/js/promise.js. | 652 // namespace of such ids, managed by src/js/promise.js. |
653 void* ptr = reinterpret_cast<void*>(id * 2 + 1); | 653 void* ptr = reinterpret_cast<void*>(id * 2 + 1); |
654 if (type == v8AsyncTaskEventEnqueue) | 654 if (type == v8AsyncTaskEventEnqueue) |
655 asyncTaskScheduled(name, ptr, false); | 655 asyncTaskScheduled(name, ptr, false); |
656 else if (type == v8AsyncTaskEventWillHandle) | 656 else if (type == v8AsyncTaskEventWillHandle) |
657 asyncTaskStarted(ptr); | 657 asyncTaskStarted(ptr); |
658 else if (type == v8AsyncTaskEventDidHandle) | 658 else if (type == v8AsyncTaskEventDidHandle) |
659 asyncTaskFinished(ptr); | 659 asyncTaskFinished(ptr); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
973 | 973 |
974 size_t stackSize = | 974 size_t stackSize = |
975 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; | 975 fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture : 1; |
976 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 976 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
977 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 977 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
978 | 978 |
979 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 979 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
980 } | 980 } |
981 | 981 |
982 } // namespace v8_inspector | 982 } // namespace v8_inspector |
OLD | NEW |