| OLD | NEW |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 break_on_exception_(false), | 53 break_on_exception_(false), |
| 54 break_on_uncaught_exception_(false), | 54 break_on_uncaught_exception_(false), |
| 55 side_effect_check_failed_(false), | 55 side_effect_check_failed_(false), |
| 56 debug_info_list_(NULL), | 56 debug_info_list_(NULL), |
| 57 feature_tracker_(isolate), | 57 feature_tracker_(isolate), |
| 58 isolate_(isolate) { | 58 isolate_(isolate) { |
| 59 ThreadInit(); | 59 ThreadInit(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 BreakLocation BreakLocation::FromFrame(StandardFrame* frame) { | 62 BreakLocation BreakLocation::FromFrame(StandardFrame* frame) { |
| 63 // TODO(clemensh): Handle Wasm frames. | 63 if (frame->is_wasm()) { |
| 64 DCHECK(!frame->is_wasm()); | 64 WasmInterpreterEntryFrame* wasm_frame = |
| 65 WasmInterpreterEntryFrame::cast(frame); |
| 66 return wasm_frame->wasm_instance()->compiled_module()->GetBreakLocation( |
| 67 wasm_frame->position()); |
| 68 } |
| 65 | 69 |
| 66 auto summary = FrameSummary::GetFirst(frame).AsJavaScript(); | 70 auto summary = FrameSummary::GetFirst(frame).AsJavaScript(); |
| 67 int offset = summary.code_offset(); | 71 int offset = summary.code_offset(); |
| 68 Handle<AbstractCode> abstract_code = summary.abstract_code(); | 72 Handle<AbstractCode> abstract_code = summary.abstract_code(); |
| 69 if (abstract_code->IsCode()) offset = offset - 1; | 73 if (abstract_code->IsCode()) offset = offset - 1; |
| 70 Handle<DebugInfo> debug_info(summary.function()->shared()->GetDebugInfo()); | 74 Handle<DebugInfo> debug_info(summary.function()->shared()->GetDebugInfo()); |
| 71 auto it = BreakIterator::GetIterator(debug_info, abstract_code); | 75 auto it = BreakIterator::GetIterator(debug_info, abstract_code); |
| 72 it->SkipTo(BreakIndexFromCodeOffset(debug_info, abstract_code, offset)); | 76 it->SkipTo(BreakIndexFromCodeOffset(debug_info, abstract_code, offset)); |
| 73 return it->GetBreakLocation(); | 77 return it->GetBreakLocation(); |
| 74 } | 78 } |
| (...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2323 | 2327 |
| 2324 // Store the previous break id, frame id and return value. | 2328 // Store the previous break id, frame id and return value. |
| 2325 break_id_ = debug_->break_id(); | 2329 break_id_ = debug_->break_id(); |
| 2326 break_frame_id_ = debug_->break_frame_id(); | 2330 break_frame_id_ = debug_->break_frame_id(); |
| 2327 return_value_ = debug_->return_value(); | 2331 return_value_ = debug_->return_value(); |
| 2328 | 2332 |
| 2329 // Create the new break info. If there is no proper frames there is no break | 2333 // Create the new break info. If there is no proper frames there is no break |
| 2330 // frame id. | 2334 // frame id. |
| 2331 StackTraceFrameIterator it(isolate()); | 2335 StackTraceFrameIterator it(isolate()); |
| 2332 bool has_frames = !it.done(); | 2336 bool has_frames = !it.done(); |
| 2333 // We don't currently support breaking inside wasm framess. | |
| 2334 DCHECK(!has_frames || !it.is_wasm()); | |
| 2335 debug_->thread_local_.break_frame_id_ = | 2337 debug_->thread_local_.break_frame_id_ = |
| 2336 has_frames ? it.frame()->id() : StackFrame::NO_ID; | 2338 has_frames ? it.frame()->id() : StackFrame::NO_ID; |
| 2337 debug_->SetNextBreakId(); | 2339 debug_->SetNextBreakId(); |
| 2338 | 2340 |
| 2339 debug_->UpdateState(); | 2341 debug_->UpdateState(); |
| 2340 // Make sure that debugger is loaded and enter the debugger context. | 2342 // Make sure that debugger is loaded and enter the debugger context. |
| 2341 // The previous context is kept in save_. | 2343 // The previous context is kept in save_. |
| 2342 failed_ = !debug_->is_loaded(); | 2344 failed_ = !debug_->is_loaded(); |
| 2343 if (!failed_) isolate()->set_context(*debug->debug_context()); | 2345 if (!failed_) isolate()->set_context(*debug->debug_context()); |
| 2344 } | 2346 } |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 logger_->DebugEvent("Put", message.text()); | 2636 logger_->DebugEvent("Put", message.text()); |
| 2635 } | 2637 } |
| 2636 | 2638 |
| 2637 void LockingCommandMessageQueue::Clear() { | 2639 void LockingCommandMessageQueue::Clear() { |
| 2638 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2640 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2639 queue_.Clear(); | 2641 queue_.Clear(); |
| 2640 } | 2642 } |
| 2641 | 2643 |
| 2642 } // namespace internal | 2644 } // namespace internal |
| 2643 } // namespace v8 | 2645 } // namespace v8 |
| OLD | NEW |