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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace v8 { | 33 namespace v8 { |
34 | 34 |
35 | 35 |
36 void HandleDebugEvent(DebugEvent event, | 36 void HandleDebugEvent(DebugEvent event, |
37 Handle<Object> exec_state, | 37 Handle<Object> exec_state, |
38 Handle<Object> event_data, | 38 Handle<Object> event_data, |
39 Handle<Value> data) { | 39 Handle<Value> data) { |
40 HandleScope scope; | 40 HandleScope scope; |
41 | 41 |
42 // Currently only handles break and exception events. | 42 // Check for handled event. |
43 if (event != Break && event != Exception) return; | 43 if (event != Break && event != Exception && event != AfterCompile) { |
| 44 return; |
| 45 } |
44 | 46 |
45 TryCatch try_catch; | 47 TryCatch try_catch; |
46 | 48 |
47 // Print the event details. | 49 // Print the event details. |
48 Handle<String> details = Shell::DebugEventToText(event_data); | 50 Handle<String> details = Shell::DebugEventToText(event_data); |
| 51 if (details->Length() == 0) { |
| 52 // Empty string is used to signal not to process this event. |
| 53 return; |
| 54 } |
49 String::Utf8Value str(details); | 55 String::Utf8Value str(details); |
50 printf("%s\n", *str); | 56 printf("%s\n", *str); |
51 | 57 |
52 // Get the debug command processor. | 58 // Get the debug command processor. |
53 Local<String> fun_name = String::New("debugCommandProcessor"); | 59 Local<String> fun_name = String::New("debugCommandProcessor"); |
54 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); | 60 Local<Function> fun = Function::Cast(*exec_state->Get(fun_name)); |
55 Local<Object> cmd_processor = | 61 Local<Object> cmd_processor = |
56 Object::Cast(*fun->Call(exec_state, 0, NULL)); | 62 Object::Cast(*fun->Call(exec_state, 0, NULL)); |
57 if (try_catch.HasCaught()) { | 63 if (try_catch.HasCaught()) { |
58 Shell::ReportException(&try_catch); | 64 Shell::ReportException(&try_catch); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 if (text_str.length() > 0) { | 121 if (text_str.length() > 0) { |
116 printf("%s\n", *text_str); | 122 printf("%s\n", *text_str); |
117 } | 123 } |
118 running = | 124 running = |
119 response_details->Get(String::New("running"))->ToBoolean()->Value(); | 125 response_details->Get(String::New("running"))->ToBoolean()->Value(); |
120 } | 126 } |
121 } | 127 } |
122 | 128 |
123 | 129 |
124 } // namespace v8 | 130 } // namespace v8 |
OLD | NEW |