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 510 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 1831 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 |