OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 head_ = head_->next(); | 266 head_ = head_->next(); |
267 if (head_ == NULL) { | 267 if (head_ == NULL) { |
268 ASSERT(tail_ == result); | 268 ASSERT(tail_ == result); |
269 tail_ = NULL; | 269 tail_ = NULL; |
270 } | 270 } |
271 return result; | 271 return result; |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 void RemoteDebugger::HandleMessageReceived(char* message) { | 275 void RemoteDebugger::HandleMessageReceived(char* message) { |
276 Locker lock; | 276 Locker lock(v8::Isolate::GetCurrent()); |
277 HandleScope scope; | 277 HandleScope scope; |
278 | 278 |
279 // Print the event details. | 279 // Print the event details. |
280 TryCatch try_catch; | 280 TryCatch try_catch; |
281 Handle<Object> details = | 281 Handle<Object> details = |
282 Shell::DebugMessageDetails(Handle<String>::Cast(String::New(message))); | 282 Shell::DebugMessageDetails(Handle<String>::Cast(String::New(message))); |
283 if (try_catch.HasCaught()) { | 283 if (try_catch.HasCaught()) { |
284 Shell::ReportException(&try_catch); | 284 Shell::ReportException(&try_catch); |
285 PrintPrompt(); | 285 PrintPrompt(); |
286 return; | 286 return; |
287 } | 287 } |
288 String::Utf8Value str(details->Get(String::New("text"))); | 288 String::Utf8Value str(details->Get(String::New("text"))); |
289 if (str.length() == 0) { | 289 if (str.length() == 0) { |
290 // Empty string is used to signal not to process this event. | 290 // Empty string is used to signal not to process this event. |
291 return; | 291 return; |
292 } | 292 } |
293 if (*str != NULL) { | 293 if (*str != NULL) { |
294 printf("%s\n", *str); | 294 printf("%s\n", *str); |
295 } else { | 295 } else { |
296 printf("???\n"); | 296 printf("???\n"); |
297 } | 297 } |
298 | 298 |
299 bool is_running = details->Get(String::New("running"))->ToBoolean()->Value(); | 299 bool is_running = details->Get(String::New("running"))->ToBoolean()->Value(); |
300 PrintPrompt(is_running); | 300 PrintPrompt(is_running); |
301 } | 301 } |
302 | 302 |
303 | 303 |
304 void RemoteDebugger::HandleKeyboardCommand(char* command) { | 304 void RemoteDebugger::HandleKeyboardCommand(char* command) { |
305 Locker lock; | 305 Locker lock(v8::Isolate::GetCurrent()); |
306 HandleScope scope; | 306 HandleScope scope; |
307 | 307 |
308 // Convert the debugger command to a JSON debugger request. | 308 // Convert the debugger command to a JSON debugger request. |
309 TryCatch try_catch; | 309 TryCatch try_catch; |
310 Handle<Value> request = | 310 Handle<Value> request = |
311 Shell::DebugCommandToJSONRequest(String::New(command)); | 311 Shell::DebugCommandToJSONRequest(String::New(command)); |
312 if (try_catch.HasCaught()) { | 312 if (try_catch.HasCaught()) { |
313 Shell::ReportException(&try_catch); | 313 Shell::ReportException(&try_catch); |
314 PrintPrompt(); | 314 PrintPrompt(); |
315 return; | 315 return; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 // Pass the keyboard command to the main thread. | 361 // Pass the keyboard command to the main thread. |
362 remote_debugger_->KeyboardCommand( | 362 remote_debugger_->KeyboardCommand( |
363 i::SmartArrayPointer<char>(i::StrDup(command))); | 363 i::SmartArrayPointer<char>(i::StrDup(command))); |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 | 367 |
368 } // namespace v8 | 368 } // namespace v8 |
369 | 369 |
370 #endif // ENABLE_DEBUGGER_SUPPORT | 370 #endif // ENABLE_DEBUGGER_SUPPORT |
OLD | NEW |