| 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 2299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2310 | 2310 |
| 2311 // Notify the debug event listeners. Indicate auto continue if the break was | 2311 // Notify the debug event listeners. Indicate auto continue if the break was |
| 2312 // a debug command break. | 2312 // a debug command break. |
| 2313 OnDebugBreak(isolate_->factory()->undefined_value(), debug_command_only); | 2313 OnDebugBreak(isolate_->factory()->undefined_value(), debug_command_only); |
| 2314 } | 2314 } |
| 2315 | 2315 |
| 2316 #ifdef DEBUG | 2316 #ifdef DEBUG |
| 2317 void Debug::PrintBreakLocation() { | 2317 void Debug::PrintBreakLocation() { |
| 2318 if (!FLAG_print_break_location) return; | 2318 if (!FLAG_print_break_location) return; |
| 2319 HandleScope scope(isolate_); | 2319 HandleScope scope(isolate_); |
| 2320 JavaScriptFrameIterator iterator(isolate_); | 2320 StackTraceFrameIterator iterator(isolate_); |
| 2321 if (iterator.done()) return; | 2321 if (iterator.done()) return; |
| 2322 JavaScriptFrame* frame = iterator.frame(); | 2322 StandardFrame* frame = iterator.frame(); |
| 2323 FrameSummary summary = FrameSummary::GetTop(frame); | 2323 FrameSummary summary = FrameSummary::GetTop(frame); |
| 2324 int source_position = summary.SourcePosition(); | 2324 int source_position = summary.SourcePosition(); |
| 2325 Handle<Object> script_obj = summary.script(); | 2325 Handle<Object> script_obj = summary.script(); |
| 2326 PrintF("[debug] break in function '"); | 2326 PrintF("[debug] break in function '"); |
| 2327 summary.FunctionName()->PrintOn(stdout); | 2327 summary.FunctionName()->PrintOn(stdout); |
| 2328 PrintF("'.\n"); | 2328 PrintF("'.\n"); |
| 2329 if (script_obj->IsScript()) { | 2329 if (script_obj->IsScript()) { |
| 2330 Handle<Script> script = Handle<Script>::cast(script_obj); | 2330 Handle<Script> script = Handle<Script>::cast(script_obj); |
| 2331 Handle<String> source(String::cast(script->source())); | 2331 Handle<String> source(String::cast(script->source())); |
| 2332 Script::InitLineEnds(script); | 2332 Script::InitLineEnds(script); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2365 | 2365 |
| 2366 // Store the previous break id, frame id and return value. | 2366 // Store the previous break id, frame id and return value. |
| 2367 break_id_ = debug_->break_id(); | 2367 break_id_ = debug_->break_id(); |
| 2368 break_frame_id_ = debug_->break_frame_id(); | 2368 break_frame_id_ = debug_->break_frame_id(); |
| 2369 return_value_ = debug_->return_value(); | 2369 return_value_ = debug_->return_value(); |
| 2370 | 2370 |
| 2371 // Create the new break info. If there is no proper frames there is no break | 2371 // Create the new break info. If there is no proper frames there is no break |
| 2372 // frame id. | 2372 // frame id. |
| 2373 StackTraceFrameIterator it(isolate()); | 2373 StackTraceFrameIterator it(isolate()); |
| 2374 bool has_frames = !it.done(); | 2374 bool has_frames = !it.done(); |
| 2375 // We don't currently support breaking inside wasm framess. | |
| 2376 DCHECK(!has_frames || !it.is_wasm()); | |
| 2377 debug_->thread_local_.break_frame_id_ = | 2375 debug_->thread_local_.break_frame_id_ = |
| 2378 has_frames ? it.frame()->id() : StackFrame::NO_ID; | 2376 has_frames ? it.frame()->id() : StackFrame::NO_ID; |
| 2379 debug_->SetNextBreakId(); | 2377 debug_->SetNextBreakId(); |
| 2380 | 2378 |
| 2381 debug_->UpdateState(); | 2379 debug_->UpdateState(); |
| 2382 // Make sure that debugger is loaded and enter the debugger context. | 2380 // Make sure that debugger is loaded and enter the debugger context. |
| 2383 // The previous context is kept in save_. | 2381 // The previous context is kept in save_. |
| 2384 failed_ = !debug_->is_loaded(); | 2382 failed_ = !debug_->is_loaded(); |
| 2385 if (!failed_) isolate()->set_context(*debug->debug_context()); | 2383 if (!failed_) isolate()->set_context(*debug->debug_context()); |
| 2386 } | 2384 } |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2667 logger_->DebugEvent("Put", message.text()); | 2665 logger_->DebugEvent("Put", message.text()); |
| 2668 } | 2666 } |
| 2669 | 2667 |
| 2670 void LockingCommandMessageQueue::Clear() { | 2668 void LockingCommandMessageQueue::Clear() { |
| 2671 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2669 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2672 queue_.Clear(); | 2670 queue_.Clear(); |
| 2673 } | 2671 } |
| 2674 | 2672 |
| 2675 } // namespace internal | 2673 } // namespace internal |
| 2676 } // namespace v8 | 2674 } // namespace v8 |
| OLD | NEW |