Chromium Code Reviews| 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()), |