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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
===================================================================
--- src/debug.cc (revision 2564)
+++ src/debug.cc (working copy)
@@ -2264,12 +2264,35 @@
}
+static bool CompareAsciiWithUtf16(const char* s1, Vector<const uint16_t> s2) {
+ const char* p = s1;
+ int i = 0;
+ while (*p != '\0' && i < s2.length()) {
+ if (static_cast<uint16_t>(*p) != s2[i]) {
+ return false;
+ }
+ ++p;
+ ++i;
+ }
+
+ return *p == '\0' && i == s2.length();
+}
+
+
// Puts a command coming from the public API on the queue. Creates
// a copy of the command string managed by the debugger. Up to this
// point, the command data was managed by the API client. Called
// by the API client thread.
void Debugger::ProcessCommand(Vector<const uint16_t> command,
v8::Debug::ClientData* client_data) {
+ // First check for non-JSON command break. VM is supposed to be busy,
+ // so we cannot use it to handle JSON.
+ if (CompareAsciiWithUtf16("break", command)) {
Mikhail Naganov 2009/08/05 07:37:00 FYI, an alternative to rolling out your own compar
+ PrintF("v8::Debug::DebugBreak()\n");
+ v8::Debug::DebugBreak();
+ return;
+ }
+
// Need to cast away const.
CommandMessage message = CommandMessage::New(
Vector<uint16_t>(const_cast<uint16_t*>(command.start()),
« 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