| 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 Local<String> to_json_fun_name = String::New("toJSONProtocol"); | 50 Local<String> to_json_fun_name = String::New("toJSONProtocol"); |
| 51 Local<Function> to_json_fun = | 51 Local<Function> to_json_fun = |
| 52 Function::Cast(*event_data->Get(to_json_fun_name)); | 52 Function::Cast(*event_data->Get(to_json_fun_name)); |
| 53 Local<Value> event_json = to_json_fun->Call(event_data, 0, NULL); | 53 Local<Value> event_json = to_json_fun->Call(event_data, 0, NULL); |
| 54 if (try_catch.HasCaught()) { | 54 if (try_catch.HasCaught()) { |
| 55 Shell::ReportException(&try_catch); | 55 Shell::ReportException(&try_catch); |
| 56 return; | 56 return; |
| 57 } | 57 } |
| 58 | 58 |
| 59 // Print the event details. | 59 // Print the event details. |
| 60 Handle<String> details = | 60 Handle<Object> details = |
| 61 Shell::DebugEventToText(Handle<String>::Cast(event_json)); | 61 Shell::DebugMessageDetails(Handle<String>::Cast(event_json)); |
| 62 if (details->Length() == 0) { | 62 if (try_catch.HasCaught()) { |
| 63 Shell::ReportException(&try_catch); |
| 64 return; |
| 65 } |
| 66 String::Utf8Value str(details->Get(String::New("text"))); |
| 67 if (str.length() == 0) { |
| 63 // Empty string is used to signal not to process this event. | 68 // Empty string is used to signal not to process this event. |
| 64 return; | 69 return; |
| 65 } | 70 } |
| 66 String::Utf8Value str(details); | |
| 67 printf("%s\n", *str); | 71 printf("%s\n", *str); |
| 68 | 72 |
| 69 // Get the debug command processor. | 73 // Get the debug command processor. |
| 70 Local<String> fun_name = String::New("debugCommandProcessor"); | 74 Local<String> fun_name = String::New("debugCommandProcessor"); |
| 71 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); | 75 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); |
| 72 Local<Object> cmd_processor = | 76 Local<Object> cmd_processor = |
| 73 Object::Cast(*fun->Call(exec_state, 0, NULL)); | 77 Object::Cast(*fun->Call(exec_state, 0, NULL)); |
| 74 if (try_catch.HasCaught()) { | 78 if (try_catch.HasCaught()) { |
| 75 Shell::ReportException(&try_catch); | 79 Shell::ReportException(&try_catch); |
| 76 return; | 80 return; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 fun = Handle<Function>::Cast(cmd_processor->Get(fun_name)); | 120 fun = Handle<Function>::Cast(cmd_processor->Get(fun_name)); |
| 117 args[0] = request; | 121 args[0] = request; |
| 118 Handle<Value> response_val = fun->Call(cmd_processor, kArgc, args); | 122 Handle<Value> response_val = fun->Call(cmd_processor, kArgc, args); |
| 119 if (try_catch.HasCaught()) { | 123 if (try_catch.HasCaught()) { |
| 120 Shell::ReportException(&try_catch); | 124 Shell::ReportException(&try_catch); |
| 121 continue; | 125 continue; |
| 122 } | 126 } |
| 123 Handle<String> response = Handle<String>::Cast(response_val); | 127 Handle<String> response = Handle<String>::Cast(response_val); |
| 124 | 128 |
| 125 // Convert the debugger response into text details and the running state. | 129 // Convert the debugger response into text details and the running state. |
| 126 Handle<Object> response_details = Shell::DebugResponseDetails(response); | 130 Handle<Object> response_details = Shell::DebugMessageDetails(response); |
| 127 if (try_catch.HasCaught()) { | 131 if (try_catch.HasCaught()) { |
| 128 Shell::ReportException(&try_catch); | 132 Shell::ReportException(&try_catch); |
| 129 continue; | 133 continue; |
| 130 } | 134 } |
| 131 String::Utf8Value text_str(response_details->Get(String::New("text"))); | 135 String::Utf8Value text_str(response_details->Get(String::New("text"))); |
| 132 if (text_str.length() > 0) { | 136 if (text_str.length() > 0) { |
| 133 printf("%s\n", *text_str); | 137 printf("%s\n", *text_str); |
| 134 } | 138 } |
| 135 running = | 139 running = |
| 136 response_details->Get(String::New("running"))->ToBoolean()->Value(); | 140 response_details->Get(String::New("running"))->ToBoolean()->Value(); |
| 137 } | 141 } |
| 138 } | 142 } |
| 139 | 143 |
| 140 | 144 |
| 141 } // namespace v8 | 145 } // namespace v8 |
| OLD | NEW |