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