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 1807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1818 return; | 1818 return; |
1819 } | 1819 } |
1820 | 1820 |
1821 // Check if the command is a host dispatch. | 1821 // Check if the command is a host dispatch. |
1822 if (command[0] == 0) { | 1822 if (command[0] == 0) { |
1823 if (Debugger::host_dispatch_handler_) { | 1823 if (Debugger::host_dispatch_handler_) { |
1824 int32_t dispatch = (command[1] << 16) | command[2]; | 1824 int32_t dispatch = (command[1] << 16) | command[2]; |
1825 Debugger::host_dispatch_handler_(reinterpret_cast<void*>(dispatch), | 1825 Debugger::host_dispatch_handler_(reinterpret_cast<void*>(dispatch), |
1826 Debugger::host_dispatch_handler_data_); | 1826 Debugger::host_dispatch_handler_data_); |
1827 } | 1827 } |
| 1828 if (auto_continue && !HasCommands()) { |
| 1829 return; |
| 1830 } |
1828 continue; | 1831 continue; |
1829 } | 1832 } |
1830 | 1833 |
1831 // Invoke JavaScript to process the debug request. | 1834 // Invoke JavaScript to process the debug request. |
1832 v8::Local<v8::String> fun_name; | 1835 v8::Local<v8::String> fun_name; |
1833 v8::Local<v8::Function> fun; | 1836 v8::Local<v8::Function> fun; |
1834 v8::Local<v8::Value> request; | 1837 v8::Local<v8::Value> request; |
1835 v8::TryCatch try_catch; | 1838 v8::TryCatch try_catch; |
1836 fun_name = v8::String::New("processDebugRequest"); | 1839 fun_name = v8::String::New("processDebugRequest"); |
1837 fun = v8::Function::Cast(*cmd_processor->Get(fun_name)); | 1840 fun = v8::Function::Cast(*cmd_processor->Get(fun_name)); |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2023 // processing of the command to the DebugMessageThread thread. | 2026 // processing of the command to the DebugMessageThread thread. |
2024 // The new copy of the command is destroyed in HandleCommand(). | 2027 // The new copy of the command is destroyed in HandleCommand(). |
2025 void Debugger::ProcessCommand(Vector<const uint16_t> command) { | 2028 void Debugger::ProcessCommand(Vector<const uint16_t> command) { |
2026 // Make a copy of the command. Need to cast away const for Clone to work. | 2029 // Make a copy of the command. Need to cast away const for Clone to work. |
2027 Vector<uint16_t> command_copy = | 2030 Vector<uint16_t> command_copy = |
2028 Vector<uint16_t>(const_cast<uint16_t*>(command.start()), | 2031 Vector<uint16_t>(const_cast<uint16_t*>(command.start()), |
2029 command.length()).Clone(); | 2032 command.length()).Clone(); |
2030 Logger::DebugTag("Put command on command_queue."); | 2033 Logger::DebugTag("Put command on command_queue."); |
2031 command_queue_.Put(command_copy); | 2034 command_queue_.Put(command_copy); |
2032 command_received_->Signal(); | 2035 command_received_->Signal(); |
| 2036 |
| 2037 // Set the debug command break flag to have the command processed. |
2033 if (!Debug::InDebugger()) { | 2038 if (!Debug::InDebugger()) { |
2034 StackGuard::DebugCommand(); | 2039 StackGuard::DebugCommand(); |
2035 } | 2040 } |
2036 } | 2041 } |
2037 | 2042 |
2038 | 2043 |
2039 bool Debugger::HasCommands() { | 2044 bool Debugger::HasCommands() { |
2040 return !command_queue_.IsEmpty(); | 2045 return !command_queue_.IsEmpty(); |
2041 } | 2046 } |
2042 | 2047 |
2043 | 2048 |
2044 void Debugger::ProcessHostDispatch(void* dispatch) { | 2049 void Debugger::ProcessHostDispatch(void* dispatch) { |
2045 // Puts a host dispatch comming from the public API on the queue. | 2050 // Puts a host dispatch comming from the public API on the queue. |
2046 uint16_t hack[3]; | 2051 uint16_t hack[3]; |
2047 hack[0] = 0; | 2052 hack[0] = 0; |
2048 hack[1] = reinterpret_cast<uint32_t>(dispatch) >> 16; | 2053 hack[1] = reinterpret_cast<uint32_t>(dispatch) >> 16; |
2049 hack[2] = reinterpret_cast<uint32_t>(dispatch) & 0xFFFF; | 2054 hack[2] = reinterpret_cast<uint32_t>(dispatch) & 0xFFFF; |
2050 Logger::DebugTag("Put dispatch on command_queue."); | 2055 Logger::DebugTag("Put dispatch on command_queue."); |
2051 command_queue_.Put(Vector<uint16_t>(hack, 3).Clone()); | 2056 command_queue_.Put(Vector<uint16_t>(hack, 3).Clone()); |
2052 command_received_->Signal(); | 2057 command_received_->Signal(); |
| 2058 |
| 2059 // Set the debug command break flag to have the host dispatch processed. |
| 2060 if (!Debug::InDebugger()) { |
| 2061 StackGuard::DebugCommand(); |
| 2062 } |
2053 } | 2063 } |
2054 | 2064 |
2055 | 2065 |
2056 bool Debugger::IsDebuggerActive() { | 2066 bool Debugger::IsDebuggerActive() { |
2057 ScopedLock with(debugger_access_); | 2067 ScopedLock with(debugger_access_); |
2058 | 2068 |
2059 return message_handler_ != NULL || !event_listener_.is_null(); | 2069 return message_handler_ != NULL || !event_listener_.is_null(); |
2060 } | 2070 } |
2061 | 2071 |
2062 | 2072 |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2208 } | 2218 } |
2209 | 2219 |
2210 | 2220 |
2211 void LockingMessageQueue::Clear() { | 2221 void LockingMessageQueue::Clear() { |
2212 ScopedLock sl(lock_); | 2222 ScopedLock sl(lock_); |
2213 queue_.Clear(); | 2223 queue_.Clear(); |
2214 } | 2224 } |
2215 | 2225 |
2216 | 2226 |
2217 } } // namespace v8::internal | 2227 } } // namespace v8::internal |
OLD | NEW |