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

Side by Side Diff: src/debug.cc

Issue 160605: Support "break"/suspend command (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
2257 // public API. 2257 // public API.
2258 void Debugger::InvokeMessageHandler(MessageImpl message) { 2258 void Debugger::InvokeMessageHandler(MessageImpl message) {
2259 ScopedLock with(debugger_access_); 2259 ScopedLock with(debugger_access_);
2260 2260
2261 if (message_handler_ != NULL) { 2261 if (message_handler_ != NULL) {
2262 message_handler_(message); 2262 message_handler_(message);
2263 } 2263 }
2264 } 2264 }
2265 2265
2266 2266
2267 static bool CompareAsciiWithUtf16(const char* s1, Vector<const uint16_t> s2) {
2268 const char* p = s1;
2269 int i = 0;
2270 while (*p != '\0' && i < s2.length()) {
2271 if (static_cast<uint16_t>(*p) != s2[i]) {
2272 return false;
2273 }
2274 ++p;
2275 ++i;
2276 }
2277
2278 return *p == '\0' && i == s2.length();
2279 }
2280
2281
2267 // Puts a command coming from the public API on the queue. Creates 2282 // Puts a command coming from the public API on the queue. Creates
2268 // a copy of the command string managed by the debugger. Up to this 2283 // a copy of the command string managed by the debugger. Up to this
2269 // point, the command data was managed by the API client. Called 2284 // point, the command data was managed by the API client. Called
2270 // by the API client thread. 2285 // by the API client thread.
2271 void Debugger::ProcessCommand(Vector<const uint16_t> command, 2286 void Debugger::ProcessCommand(Vector<const uint16_t> command,
2272 v8::Debug::ClientData* client_data) { 2287 v8::Debug::ClientData* client_data) {
2288 // First check for non-JSON command break. VM is supposed to be busy,
2289 // so we cannot use it to handle JSON.
2290 if (CompareAsciiWithUtf16("break", command)) {
Mikhail Naganov 2009/08/05 07:37:00 FYI, an alternative to rolling out your own compar
2291 PrintF("v8::Debug::DebugBreak()\n");
2292 v8::Debug::DebugBreak();
2293 return;
2294 }
2295
2273 // Need to cast away const. 2296 // Need to cast away const.
2274 CommandMessage message = CommandMessage::New( 2297 CommandMessage message = CommandMessage::New(
2275 Vector<uint16_t>(const_cast<uint16_t*>(command.start()), 2298 Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
2276 command.length()), 2299 command.length()),
2277 client_data); 2300 client_data);
2278 Logger::DebugTag("Put command on command_queue."); 2301 Logger::DebugTag("Put command on command_queue.");
2279 command_queue_.Put(message); 2302 command_queue_.Put(message);
2280 command_received_->Signal(); 2303 command_received_->Signal();
2281 2304
2282 // Set the debug command break flag to have the command processed. 2305 // Set the debug command break flag to have the command processed.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 2585
2563 2586
2564 void LockingCommandMessageQueue::Clear() { 2587 void LockingCommandMessageQueue::Clear() {
2565 ScopedLock sl(lock_); 2588 ScopedLock sl(lock_);
2566 queue_.Clear(); 2589 queue_.Clear();
2567 } 2590 }
2568 2591
2569 #endif // ENABLE_DEBUGGER_SUPPORT 2592 #endif // ENABLE_DEBUGGER_SUPPORT
2570 2593
2571 } } // namespace v8::internal 2594 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698