Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: src/debug/debug.cc

Issue 2626253002: [wasm] Set and store breakpoints in wasm (Closed)
Patch Set: Remove CheckBreakPoints methods Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 11 matching lines...) Expand all
22 #include "src/full-codegen/full-codegen.h" 22 #include "src/full-codegen/full-codegen.h"
23 #include "src/global-handles.h" 23 #include "src/global-handles.h"
24 #include "src/globals.h" 24 #include "src/globals.h"
25 #include "src/interpreter/interpreter.h" 25 #include "src/interpreter/interpreter.h"
26 #include "src/isolate-inl.h" 26 #include "src/isolate-inl.h"
27 #include "src/list.h" 27 #include "src/list.h"
28 #include "src/log.h" 28 #include "src/log.h"
29 #include "src/messages.h" 29 #include "src/messages.h"
30 #include "src/snapshot/natives.h" 30 #include "src/snapshot/natives.h"
31 #include "src/wasm/wasm-module.h" 31 #include "src/wasm/wasm-module.h"
32 #include "src/wasm/wasm-objects.h"
32 33
33 #include "include/v8-debug.h" 34 #include "include/v8-debug.h"
34 35
35 namespace v8 { 36 namespace v8 {
36 namespace internal { 37 namespace internal {
37 38
38 Debug::Debug(Isolate* isolate) 39 Debug::Debug(Isolate* isolate)
39 : debug_context_(Handle<Context>()), 40 : debug_context_(Handle<Context>()),
40 event_listener_(Handle<Object>()), 41 event_listener_(Handle<Object>()),
41 event_listener_data_(Handle<Object>()), 42 event_listener_data_(Handle<Object>()),
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 // Just continue if breaks are disabled or debugger cannot be loaded. 510 // Just continue if breaks are disabled or debugger cannot be loaded.
510 if (break_disabled()) return; 511 if (break_disabled()) return;
511 512
512 // Enter the debugger. 513 // Enter the debugger.
513 DebugScope debug_scope(this); 514 DebugScope debug_scope(this);
514 if (debug_scope.failed()) return; 515 if (debug_scope.failed()) return;
515 516
516 // Postpone interrupt during breakpoint processing. 517 // Postpone interrupt during breakpoint processing.
517 PostponeInterruptsScope postpone(isolate_); 518 PostponeInterruptsScope postpone(isolate_);
518 519
519 // Return if we fail to retrieve debug info for javascript frames. 520 // Return if we fail to retrieve debug info.
520 if (frame->is_java_script()) { 521 Handle<JSFunction> function(frame->function());
521 JavaScriptFrame* js_frame = JavaScriptFrame::cast(frame); 522 Handle<SharedFunctionInfo> shared(function->shared());
522 523 if (!EnsureDebugInfo(shared, function)) return;
523 // Get the debug info (create it if it does not exist).
524 Handle<JSFunction> function(js_frame->function());
525 Handle<SharedFunctionInfo> shared(function->shared());
526 if (!EnsureDebugInfo(shared, function)) return;
527 }
528 524
529 BreakLocation location = BreakLocation::FromFrame(frame); 525 BreakLocation location = BreakLocation::FromFrame(frame);
530 526
531 // Find actual break points, if any, and trigger debug break event. 527 // Find actual break points, if any, and trigger debug break event.
532 MaybeHandle<FixedArray> break_points_hit; 528 MaybeHandle<FixedArray> break_points_hit;
533 if (!break_points_active()) { 529 if (break_points_active()) {
534 // Don't try to find hit breakpoints.
535 } else if (frame->is_wasm_interpreter_entry()) {
536 // TODO(clemensh): Find hit breakpoints for wasm.
537 UNIMPLEMENTED();
538 } else {
539 // Get the debug info, which must exist if we reach here. 530 // Get the debug info, which must exist if we reach here.
540 Handle<DebugInfo> debug_info( 531 Handle<DebugInfo> debug_info(shared->GetDebugInfo(), isolate_);
541 JavaScriptFrame::cast(frame)->function()->shared()->GetDebugInfo(),
542 isolate_);
543 532
544 break_points_hit = CheckBreakPoints(debug_info, &location); 533 break_points_hit = CheckBreakPoints(debug_info, &location);
545 } 534 }
546 535
547 if (!break_points_hit.is_null()) { 536 if (!break_points_hit.is_null()) {
548 // Clear all current stepping setup. 537 // Clear all current stepping setup.
549 ClearStepping(); 538 ClearStepping();
550 // Notify the debug event listeners. 539 // Notify the debug event listeners.
551 Handle<JSArray> jsarr = isolate_->factory()->NewJSArrayWithElements( 540 Handle<JSArray> jsarr = isolate_->factory()->NewJSArrayWithElements(
552 break_points_hit.ToHandleChecked()); 541 break_points_hit.ToHandleChecked());
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 feature_tracker()->Track(DebugFeatureTracker::kBreakPoint); 704 feature_tracker()->Track(DebugFeatureTracker::kBreakPoint);
716 return true; 705 return true;
717 } 706 }
718 707
719 708
720 bool Debug::SetBreakPointForScript(Handle<Script> script, 709 bool Debug::SetBreakPointForScript(Handle<Script> script,
721 Handle<Object> break_point_object, 710 Handle<Object> break_point_object,
722 int* source_position, 711 int* source_position,
723 BreakPositionAlignment alignment) { 712 BreakPositionAlignment alignment) {
724 if (script->type() == Script::TYPE_WASM) { 713 if (script->type() == Script::TYPE_WASM) {
725 // TODO(clemensh): set breakpoint for wasm. 714 Handle<WasmCompiledModule> compiled_module(
726 return false; 715 WasmCompiledModule::cast(script->wasm_compiled_module()), isolate_);
716 return WasmCompiledModule::SetBreakPoint(compiled_module, source_position,
717 break_point_object);
727 } 718 }
719
728 HandleScope scope(isolate_); 720 HandleScope scope(isolate_);
729 721
730 // Obtain shared function info for the function. 722 // Obtain shared function info for the function.
731 Handle<Object> result = 723 Handle<Object> result =
732 FindSharedFunctionInfoInScript(script, *source_position); 724 FindSharedFunctionInfoInScript(script, *source_position);
733 if (result->IsUndefined(isolate_)) return false; 725 if (result->IsUndefined(isolate_)) return false;
734 726
735 // Make sure the function has set up the debug info. 727 // Make sure the function has set up the debug info.
736 Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>::cast(result); 728 Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo>::cast(result);
737 if (!EnsureDebugInfo(shared, Handle<JSFunction>::null())) { 729 if (!EnsureDebugInfo(shared, Handle<JSFunction>::null())) {
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after
2653 logger_->DebugEvent("Put", message.text()); 2645 logger_->DebugEvent("Put", message.text());
2654 } 2646 }
2655 2647
2656 void LockingCommandMessageQueue::Clear() { 2648 void LockingCommandMessageQueue::Clear() {
2657 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2649 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2658 queue_.Clear(); 2650 queue_.Clear();
2659 } 2651 }
2660 2652
2661 } // namespace internal 2653 } // namespace internal
2662 } // namespace v8 2654 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698