| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 615 |
| 616 | 616 |
| 617 | 617 |
| 618 | 618 |
| 619 | 619 |
| 620 // Default break enabled. | 620 // Default break enabled. |
| 621 bool Debug::disable_break_ = false; | 621 bool Debug::disable_break_ = false; |
| 622 | 622 |
| 623 // Default call debugger on uncaught exception. | 623 // Default call debugger on uncaught exception. |
| 624 bool Debug::break_on_exception_ = false; | 624 bool Debug::break_on_exception_ = false; |
| 625 bool Debug::break_on_uncaught_exception_ = true; | 625 bool Debug::break_on_uncaught_exception_ = false; |
| 626 | 626 |
| 627 Handle<Context> Debug::debug_context_ = Handle<Context>(); | 627 Handle<Context> Debug::debug_context_ = Handle<Context>(); |
| 628 Code* Debug::debug_break_return_ = NULL; | 628 Code* Debug::debug_break_return_ = NULL; |
| 629 Code* Debug::debug_break_slot_ = NULL; | 629 Code* Debug::debug_break_slot_ = NULL; |
| 630 | 630 |
| 631 | 631 |
| 632 void ScriptCache::Add(Handle<Script> script) { | 632 void ScriptCache::Add(Handle<Script> script) { |
| 633 // Create an entry in the hash map for the script. | 633 // Create an entry in the hash map for the script. |
| 634 int id = Smi::cast(script->id())->value(); | 634 int id = Smi::cast(script->id())->value(); |
| 635 HashMap::Entry* entry = | 635 HashMap::Entry* entry = |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 v8::Handle<ObjectTemplate>(), | 828 v8::Handle<ObjectTemplate>(), |
| 829 NULL); | 829 NULL); |
| 830 | 830 |
| 831 // Use the debugger context. | 831 // Use the debugger context. |
| 832 SaveContext save; | 832 SaveContext save; |
| 833 Top::set_context(*context); | 833 Top::set_context(*context); |
| 834 | 834 |
| 835 // Expose the builtins object in the debugger context. | 835 // Expose the builtins object in the debugger context. |
| 836 Handle<String> key = Factory::LookupAsciiSymbol("builtins"); | 836 Handle<String> key = Factory::LookupAsciiSymbol("builtins"); |
| 837 Handle<GlobalObject> global = Handle<GlobalObject>(context->global()); | 837 Handle<GlobalObject> global = Handle<GlobalObject>(context->global()); |
| 838 SetProperty(global, key, Handle<Object>(global->builtins()), NONE); | 838 RETURN_IF_EMPTY_HANDLE_VALUE( |
| 839 SetProperty(global, key, Handle<Object>(global->builtins()), NONE), |
| 840 false); |
| 839 | 841 |
| 840 // Compile the JavaScript for the debugger in the debugger context. | 842 // Compile the JavaScript for the debugger in the debugger context. |
| 841 Debugger::set_compiling_natives(true); | 843 Debugger::set_compiling_natives(true); |
| 842 bool caught_exception = | 844 bool caught_exception = |
| 843 !CompileDebuggerScript(Natives::GetIndex("mirror")) || | 845 !CompileDebuggerScript(Natives::GetIndex("mirror")) || |
| 844 !CompileDebuggerScript(Natives::GetIndex("debug")); | 846 !CompileDebuggerScript(Natives::GetIndex("debug")); |
| 845 | 847 |
| 846 if (FLAG_enable_liveedit) { | 848 if (FLAG_enable_liveedit) { |
| 847 caught_exception = caught_exception || | 849 caught_exception = caught_exception || |
| 848 !CompileDebuggerScript(Natives::GetIndex("liveedit")); | 850 !CompileDebuggerScript(Natives::GetIndex("liveedit")); |
| (...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2733 // it starts. | 2735 // it starts. |
| 2734 // Provide stub message handler; V8 auto-continues each suspend | 2736 // Provide stub message handler; V8 auto-continues each suspend |
| 2735 // when there is no message handler; we doesn't need it. | 2737 // when there is no message handler; we doesn't need it. |
| 2736 // Once become suspended, V8 will stay so indefinitely long, until remote | 2738 // Once become suspended, V8 will stay so indefinitely long, until remote |
| 2737 // debugger connects and issues "continue" command. | 2739 // debugger connects and issues "continue" command. |
| 2738 Debugger::message_handler_ = StubMessageHandler2; | 2740 Debugger::message_handler_ = StubMessageHandler2; |
| 2739 v8::Debug::DebugBreak(); | 2741 v8::Debug::DebugBreak(); |
| 2740 } | 2742 } |
| 2741 | 2743 |
| 2742 if (Socket::Setup()) { | 2744 if (Socket::Setup()) { |
| 2743 agent_ = new DebuggerAgent(name, port); | 2745 if (agent_ == NULL) { |
| 2744 agent_->Start(); | 2746 agent_ = new DebuggerAgent(name, port); |
| 2747 agent_->Start(); |
| 2748 } |
| 2745 return true; | 2749 return true; |
| 2746 } | 2750 } |
| 2747 | 2751 |
| 2748 return false; | 2752 return false; |
| 2749 } | 2753 } |
| 2750 | 2754 |
| 2751 | 2755 |
| 2752 void Debugger::StopAgent() { | 2756 void Debugger::StopAgent() { |
| 2753 if (agent_ != NULL) { | 2757 if (agent_ != NULL) { |
| 2754 agent_->Shutdown(); | 2758 agent_->Shutdown(); |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3071 { | 3075 { |
| 3072 Locker locker; | 3076 Locker locker; |
| 3073 Debugger::CallMessageDispatchHandler(); | 3077 Debugger::CallMessageDispatchHandler(); |
| 3074 } | 3078 } |
| 3075 } | 3079 } |
| 3076 } | 3080 } |
| 3077 | 3081 |
| 3078 #endif // ENABLE_DEBUGGER_SUPPORT | 3082 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3079 | 3083 |
| 3080 } } // namespace v8::internal | 3084 } } // namespace v8::internal |
| OLD | NEW |