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 28 matching lines...) Expand all Loading... |
39 Handle<Value> data) { | 39 Handle<Value> data) { |
40 HandleScope scope; | 40 HandleScope scope; |
41 | 41 |
42 // Check for handled event. | 42 // Check for handled event. |
43 if (event != Break && event != Exception && event != AfterCompile) { | 43 if (event != Break && event != Exception && event != AfterCompile) { |
44 return; | 44 return; |
45 } | 45 } |
46 | 46 |
47 TryCatch try_catch; | 47 TryCatch try_catch; |
48 | 48 |
| 49 // Get the toJSONProtocol function on the event and get the JSON format. |
| 50 Local<String> to_json_fun_name = String::New("toJSONProtocol"); |
| 51 Local<Function> to_json_fun = |
| 52 Function::Cast(*event_data->Get(to_json_fun_name)); |
| 53 Local<Value> event_json = to_json_fun->Call(event_data, 0, NULL); |
| 54 if (try_catch.HasCaught()) { |
| 55 Shell::ReportException(&try_catch); |
| 56 return; |
| 57 } |
| 58 |
49 // Print the event details. | 59 // Print the event details. |
50 Handle<String> details = Shell::DebugEventToText(event_data); | 60 Handle<String> details = |
| 61 Shell::DebugEventToText(Handle<String>::Cast(event_json)); |
51 if (details->Length() == 0) { | 62 if (details->Length() == 0) { |
52 // Empty string is used to signal not to process this event. | 63 // Empty string is used to signal not to process this event. |
53 return; | 64 return; |
54 } | 65 } |
55 String::Utf8Value str(details); | 66 String::Utf8Value str(details); |
56 printf("%s\n", *str); | 67 printf("%s\n", *str); |
57 | 68 |
58 // Get the debug command processor. | 69 // Get the debug command processor. |
59 Local<String> fun_name = String::New("debugCommandProcessor"); | 70 Local<String> fun_name = String::New("debugCommandProcessor"); |
60 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); | 71 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (text_str.length() > 0) { | 132 if (text_str.length() > 0) { |
122 printf("%s\n", *text_str); | 133 printf("%s\n", *text_str); |
123 } | 134 } |
124 running = | 135 running = |
125 response_details->Get(String::New("running"))->ToBoolean()->Value(); | 136 response_details->Get(String::New("running"))->ToBoolean()->Value(); |
126 } | 137 } |
127 } | 138 } |
128 | 139 |
129 | 140 |
130 } // namespace v8 | 141 } // namespace v8 |
OLD | NEW |