| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 675 int id = Smi::cast((*location)->id())->value(); | 675 int id = Smi::cast((*location)->id())->value(); |
| 676 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); | 676 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); |
| 677 script_cache->collected_scripts_.Add(id); | 677 script_cache->collected_scripts_.Add(id); |
| 678 | 678 |
| 679 // Clear the weak handle. | 679 // Clear the weak handle. |
| 680 obj.Dispose(); | 680 obj.Dispose(); |
| 681 obj.Clear(); | 681 obj.Clear(); |
| 682 } | 682 } |
| 683 | 683 |
| 684 | 684 |
| 685 void Debug::Setup(bool create_heap_objects) { | 685 void Debug::SetUp(bool create_heap_objects) { |
| 686 ThreadInit(); | 686 ThreadInit(); |
| 687 if (create_heap_objects) { | 687 if (create_heap_objects) { |
| 688 // Get code to handle debug break on return. | 688 // Get code to handle debug break on return. |
| 689 debug_break_return_ = | 689 debug_break_return_ = |
| 690 isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak); | 690 isolate_->builtins()->builtin(Builtins::kReturn_DebugBreak); |
| 691 ASSERT(debug_break_return_->IsCode()); | 691 ASSERT(debug_break_return_->IsCode()); |
| 692 // Get code to handle debug break in debug break slots. | 692 // Get code to handle debug break in debug break slots. |
| 693 debug_break_slot_ = | 693 debug_break_slot_ = |
| 694 isolate_->builtins()->builtin(Builtins::kSlot_DebugBreak); | 694 isolate_->builtins()->builtin(Builtins::kSlot_DebugBreak); |
| 695 ASSERT(debug_break_slot_->IsCode()); | 695 ASSERT(debug_break_slot_->IsCode()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 | 820 |
| 821 // Use the debugger context. | 821 // Use the debugger context. |
| 822 SaveContext save(isolate_); | 822 SaveContext save(isolate_); |
| 823 isolate_->set_context(*context); | 823 isolate_->set_context(*context); |
| 824 | 824 |
| 825 // Expose the builtins object in the debugger context. | 825 // Expose the builtins object in the debugger context. |
| 826 Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins"); | 826 Handle<String> key = isolate_->factory()->LookupAsciiSymbol("builtins"); |
| 827 Handle<GlobalObject> global = Handle<GlobalObject>(context->global()); | 827 Handle<GlobalObject> global = Handle<GlobalObject>(context->global()); |
| 828 RETURN_IF_EMPTY_HANDLE_VALUE( | 828 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 829 isolate_, | 829 isolate_, |
| 830 SetProperty(global, key, Handle<Object>(global->builtins()), | 830 JSReceiver::SetProperty(global, key, Handle<Object>(global->builtins()), |
| 831 NONE, kNonStrictMode), | 831 NONE, kNonStrictMode), |
| 832 false); | 832 false); |
| 833 | 833 |
| 834 // Compile the JavaScript for the debugger in the debugger context. | 834 // Compile the JavaScript for the debugger in the debugger context. |
| 835 debugger->set_compiling_natives(true); | 835 debugger->set_compiling_natives(true); |
| 836 bool caught_exception = | 836 bool caught_exception = |
| 837 !CompileDebuggerScript(Natives::GetIndex("mirror")) || | 837 !CompileDebuggerScript(Natives::GetIndex("mirror")) || |
| 838 !CompileDebuggerScript(Natives::GetIndex("debug")); | 838 !CompileDebuggerScript(Natives::GetIndex("debug")); |
| 839 | 839 |
| 840 if (FLAG_enable_liveedit) { | 840 if (FLAG_enable_liveedit) { |
| 841 caught_exception = caught_exception || | 841 caught_exception = caught_exception || |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 | 1206 |
| 1207 // Remove all debug info. | 1207 // Remove all debug info. |
| 1208 while (debug_info_list_ != NULL) { | 1208 while (debug_info_list_ != NULL) { |
| 1209 RemoveDebugInfo(debug_info_list_->debug_info()); | 1209 RemoveDebugInfo(debug_info_list_->debug_info()); |
| 1210 } | 1210 } |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 | 1213 |
| 1214 void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) { | 1214 void Debug::FloodWithOneShot(Handle<SharedFunctionInfo> shared) { |
| 1215 PrepareForBreakPoints(); | 1215 PrepareForBreakPoints(); |
| 1216 // Make sure the function has setup the debug info. | 1216 // Make sure the function has set up the debug info. |
| 1217 if (!EnsureDebugInfo(shared)) { | 1217 if (!EnsureDebugInfo(shared)) { |
| 1218 // Return if we failed to retrieve the debug info. | 1218 // Return if we failed to retrieve the debug info. |
| 1219 return; | 1219 return; |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 // Flood the function with break points. | 1222 // Flood the function with break points. |
| 1223 BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS); | 1223 BreakLocationIterator it(GetDebugInfo(shared), ALL_BREAK_LOCATIONS); |
| 1224 while (!it.Done()) { | 1224 while (!it.Done()) { |
| 1225 it.SetOneShot(); | 1225 it.SetOneShot(); |
| 1226 it.Next(); | 1226 it.Next(); |
| (...skipping 1621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2848 event, | 2848 event, |
| 2849 running, | 2849 running, |
| 2850 Handle<JSObject>::cast(exec_state), | 2850 Handle<JSObject>::cast(exec_state), |
| 2851 Handle<JSObject>::cast(event_data), | 2851 Handle<JSObject>::cast(event_data), |
| 2852 Handle<String>(Utils::OpenHandle(*response)), | 2852 Handle<String>(Utils::OpenHandle(*response)), |
| 2853 command.client_data()); | 2853 command.client_data()); |
| 2854 InvokeMessageHandler(message); | 2854 InvokeMessageHandler(message); |
| 2855 command.Dispose(); | 2855 command.Dispose(); |
| 2856 | 2856 |
| 2857 // Return from debug event processing if either the VM is put into the | 2857 // Return from debug event processing if either the VM is put into the |
| 2858 // runnning state (through a continue command) or auto continue is active | 2858 // running state (through a continue command) or auto continue is active |
| 2859 // and there are no more commands queued. | 2859 // and there are no more commands queued. |
| 2860 if (running && !HasCommands()) { | 2860 if (running && !HasCommands()) { |
| 2861 return; | 2861 return; |
| 2862 } | 2862 } |
| 2863 } | 2863 } |
| 2864 } | 2864 } |
| 2865 | 2865 |
| 2866 | 2866 |
| 2867 void Debugger::SetEventListener(Handle<Object> callback, | 2867 void Debugger::SetEventListener(Handle<Object> callback, |
| 2868 Handle<Object> data) { | 2868 Handle<Object> data) { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3058 // Suspend V8 if it is already running or set V8 to suspend whenever | 3058 // Suspend V8 if it is already running or set V8 to suspend whenever |
| 3059 // it starts. | 3059 // it starts. |
| 3060 // Provide stub message handler; V8 auto-continues each suspend | 3060 // Provide stub message handler; V8 auto-continues each suspend |
| 3061 // when there is no message handler; we doesn't need it. | 3061 // when there is no message handler; we doesn't need it. |
| 3062 // Once become suspended, V8 will stay so indefinitely long, until remote | 3062 // Once become suspended, V8 will stay so indefinitely long, until remote |
| 3063 // debugger connects and issues "continue" command. | 3063 // debugger connects and issues "continue" command. |
| 3064 Debugger::message_handler_ = StubMessageHandler2; | 3064 Debugger::message_handler_ = StubMessageHandler2; |
| 3065 v8::Debug::DebugBreak(); | 3065 v8::Debug::DebugBreak(); |
| 3066 } | 3066 } |
| 3067 | 3067 |
| 3068 if (Socket::Setup()) { | 3068 if (Socket::SetUp()) { |
| 3069 if (agent_ == NULL) { | 3069 if (agent_ == NULL) { |
| 3070 agent_ = new DebuggerAgent(name, port); | 3070 agent_ = new DebuggerAgent(name, port); |
| 3071 agent_->Start(); | 3071 agent_->Start(); |
| 3072 } | 3072 } |
| 3073 return true; | 3073 return true; |
| 3074 } | 3074 } |
| 3075 | 3075 |
| 3076 return false; | 3076 return false; |
| 3077 } | 3077 } |
| 3078 | 3078 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3490 { | 3490 { |
| 3491 Locker locker; | 3491 Locker locker; |
| 3492 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3492 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
| 3493 } | 3493 } |
| 3494 } | 3494 } |
| 3495 } | 3495 } |
| 3496 | 3496 |
| 3497 #endif // ENABLE_DEBUGGER_SUPPORT | 3497 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3498 | 3498 |
| 3499 } } // namespace v8::internal | 3499 } } // namespace v8::internal |
| OLD | NEW |