ager@chromium.org | 9258b6b | 2008-09-11 09:11:10 +0000 | [diff] [blame] | 1 | // Copyright 2006-2008 the V8 project authors. All rights reserved. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 28 | #ifndef V8_DEBUG_H_ |
| 29 | #define V8_DEBUG_H_ |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 30 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 31 | #include "assembler.h" |
| 32 | #include "code-stubs.h" |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 33 | #include "debug-agent.h" |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 34 | #include "execution.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 35 | #include "factory.h" |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 36 | #include "hashmap.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 37 | #include "platform.h" |
| 38 | #include "string-stream.h" |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 39 | #include "v8threads.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 40 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 41 | #ifdef ENABLE_DEBUGGER_SUPPORT |
| 42 | #include "../include/v8-debug.h" |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 43 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 44 | namespace v8 { |
| 45 | namespace internal { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 46 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 47 | |
| 48 | // Forward declarations. |
| 49 | class EnterDebugger; |
| 50 | |
| 51 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 52 | // Step actions. NOTE: These values are in macros.py as well. |
| 53 | enum StepAction { |
| 54 | StepNone = -1, // Stepping not prepared. |
| 55 | StepOut = 0, // Step out of the current function. |
| 56 | StepNext = 1, // Step to the next statement in the current function. |
| 57 | StepIn = 2, // Step into new functions invoked or the next statement |
| 58 | // in the current function. |
| 59 | StepMin = 3, // Perform a minimum step in the current function. |
| 60 | StepInMin = 4 // Step into new functions invoked or perform a minimum step |
| 61 | // in the current function. |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | // Type of exception break. NOTE: These values are in macros.py as well. |
| 66 | enum ExceptionBreakType { |
| 67 | BreakException = 0, |
| 68 | BreakUncaughtException = 1 |
| 69 | }; |
| 70 | |
| 71 | |
| 72 | // Type of exception break. NOTE: These values are in macros.py as well. |
| 73 | enum BreakLocatorType { |
| 74 | ALL_BREAK_LOCATIONS = 0, |
| 75 | SOURCE_BREAK_LOCATIONS = 1 |
| 76 | }; |
| 77 | |
| 78 | |
| 79 | // Class for iterating through the break points in a function and changing |
| 80 | // them. |
| 81 | class BreakLocationIterator { |
| 82 | public: |
| 83 | explicit BreakLocationIterator(Handle<DebugInfo> debug_info, |
| 84 | BreakLocatorType type); |
| 85 | virtual ~BreakLocationIterator(); |
| 86 | |
| 87 | void Next(); |
| 88 | void Next(int count); |
| 89 | void FindBreakLocationFromAddress(Address pc); |
| 90 | void FindBreakLocationFromPosition(int position); |
| 91 | void Reset(); |
| 92 | bool Done() const; |
| 93 | void SetBreakPoint(Handle<Object> break_point_object); |
| 94 | void ClearBreakPoint(Handle<Object> break_point_object); |
| 95 | void SetOneShot(); |
| 96 | void ClearOneShot(); |
| 97 | void PrepareStepIn(); |
| 98 | bool IsExit() const; |
| 99 | bool HasBreakPoint(); |
| 100 | bool IsDebugBreak(); |
| 101 | Object* BreakPointObjects(); |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 102 | void ClearAllDebugBreak(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 103 | |
| 104 | |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 105 | inline int code_position() { |
| 106 | return static_cast<int>(pc() - debug_info_->code()->entry()); |
| 107 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 108 | inline int break_point() { return break_point_; } |
| 109 | inline int position() { return position_; } |
| 110 | inline int statement_position() { return statement_position_; } |
| 111 | inline Address pc() { return reloc_iterator_->rinfo()->pc(); } |
| 112 | inline Code* code() { return debug_info_->code(); } |
| 113 | inline RelocInfo* rinfo() { return reloc_iterator_->rinfo(); } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 114 | inline RelocInfo::Mode rmode() const { |
| 115 | return reloc_iterator_->rinfo()->rmode(); |
| 116 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 117 | inline RelocInfo* original_rinfo() { |
| 118 | return reloc_iterator_original_->rinfo(); |
| 119 | } |
ager@chromium.org | 236ad96 | 2008-09-25 09:45:57 +0000 | [diff] [blame] | 120 | inline RelocInfo::Mode original_rmode() const { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 121 | return reloc_iterator_original_->rinfo()->rmode(); |
| 122 | } |
| 123 | |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 124 | bool IsDebuggerStatement(); |
| 125 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 126 | protected: |
| 127 | bool RinfoDone() const; |
| 128 | void RinfoNext(); |
| 129 | |
| 130 | BreakLocatorType type_; |
| 131 | int break_point_; |
| 132 | int position_; |
| 133 | int statement_position_; |
| 134 | Handle<DebugInfo> debug_info_; |
| 135 | RelocIterator* reloc_iterator_; |
| 136 | RelocIterator* reloc_iterator_original_; |
| 137 | |
| 138 | private: |
| 139 | void SetDebugBreak(); |
| 140 | void ClearDebugBreak(); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 141 | |
| 142 | void SetDebugBreakAtIC(); |
| 143 | void ClearDebugBreakAtIC(); |
| 144 | |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 145 | bool IsDebugBreakAtReturn(); |
| 146 | void SetDebugBreakAtReturn(); |
| 147 | void ClearDebugBreakAtReturn(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 148 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 149 | bool IsDebugBreakSlot(); |
| 150 | bool IsDebugBreakAtSlot(); |
| 151 | void SetDebugBreakAtSlot(); |
| 152 | void ClearDebugBreakAtSlot(); |
| 153 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 154 | DISALLOW_COPY_AND_ASSIGN(BreakLocationIterator); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 155 | }; |
| 156 | |
| 157 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 158 | // Cache of all script objects in the heap. When a script is added a weak handle |
| 159 | // to it is created and that weak handle is stored in the cache. The weak handle |
| 160 | // callback takes care of removing the script from the cache. The key used in |
| 161 | // the cache is the script id. |
| 162 | class ScriptCache : private HashMap { |
| 163 | public: |
| 164 | ScriptCache() : HashMap(ScriptMatch), collected_scripts_(10) {} |
| 165 | virtual ~ScriptCache() { Clear(); } |
| 166 | |
| 167 | // Add script to the cache. |
| 168 | void Add(Handle<Script> script); |
| 169 | |
| 170 | // Return the scripts in the cache. |
| 171 | Handle<FixedArray> GetScripts(); |
| 172 | |
| 173 | // Generate debugger events for collected scripts. |
| 174 | void ProcessCollectedScripts(); |
| 175 | |
| 176 | private: |
| 177 | // Calculate the hash value from the key (script id). |
| 178 | static uint32_t Hash(int key) { return ComputeIntegerHash(key); } |
| 179 | |
| 180 | // Scripts match if their keys (script id) match. |
| 181 | static bool ScriptMatch(void* key1, void* key2) { return key1 == key2; } |
| 182 | |
| 183 | // Clear the cache releasing all the weak handles. |
| 184 | void Clear(); |
| 185 | |
| 186 | // Weak handle callback for scripts in the cache. |
| 187 | static void HandleWeakScript(v8::Persistent<v8::Value> obj, void* data); |
| 188 | |
| 189 | // List used during GC to temporarily store id's of collected scripts. |
| 190 | List<int> collected_scripts_; |
| 191 | }; |
| 192 | |
| 193 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 194 | // Linked list holding debug info objects. The debug info objects are kept as |
| 195 | // weak handles to avoid a debug info object to keep a function alive. |
| 196 | class DebugInfoListNode { |
| 197 | public: |
| 198 | explicit DebugInfoListNode(DebugInfo* debug_info); |
| 199 | virtual ~DebugInfoListNode(); |
| 200 | |
| 201 | DebugInfoListNode* next() { return next_; } |
| 202 | void set_next(DebugInfoListNode* next) { next_ = next; } |
| 203 | Handle<DebugInfo> debug_info() { return debug_info_; } |
| 204 | |
| 205 | private: |
| 206 | // Global (weak) handle to the debug info object. |
| 207 | Handle<DebugInfo> debug_info_; |
| 208 | |
| 209 | // Next pointer for linked list. |
| 210 | DebugInfoListNode* next_; |
| 211 | }; |
| 212 | |
| 213 | |
| 214 | // This class contains the debugger support. The main purpose is to handle |
| 215 | // setting break points in the code. |
| 216 | // |
| 217 | // This class controls the debug info for all functions which currently have |
| 218 | // active breakpoints in them. This debug info is held in the heap root object |
| 219 | // debug_info which is a FixedArray. Each entry in this list is of class |
| 220 | // DebugInfo. |
| 221 | class Debug { |
| 222 | public: |
| 223 | static void Setup(bool create_heap_objects); |
| 224 | static bool Load(); |
| 225 | static void Unload(); |
| 226 | static bool IsLoaded() { return !debug_context_.is_null(); } |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 227 | static bool InDebugger() { return thread_local_.debugger_entry_ != NULL; } |
| 228 | static void PreemptionWhileInDebugger(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 229 | static void Iterate(ObjectVisitor* v); |
| 230 | |
| 231 | static Object* Break(Arguments args); |
| 232 | static void SetBreakPoint(Handle<SharedFunctionInfo> shared, |
| 233 | int source_position, |
| 234 | Handle<Object> break_point_object); |
| 235 | static void ClearBreakPoint(Handle<Object> break_point_object); |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 236 | static void ClearAllBreakPoints(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 237 | static void FloodWithOneShot(Handle<SharedFunctionInfo> shared); |
| 238 | static void FloodHandlerWithOneShot(); |
| 239 | static void ChangeBreakOnException(ExceptionBreakType type, bool enable); |
| 240 | static void PrepareStep(StepAction step_action, int step_count); |
| 241 | static void ClearStepping(); |
| 242 | static bool StepNextContinue(BreakLocationIterator* break_location_iterator, |
| 243 | JavaScriptFrame* frame); |
| 244 | static Handle<DebugInfo> GetDebugInfo(Handle<SharedFunctionInfo> shared); |
| 245 | static bool HasDebugInfo(Handle<SharedFunctionInfo> shared); |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 246 | |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 247 | // Returns whether the operation succeeded. |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 248 | static bool EnsureDebugInfo(Handle<SharedFunctionInfo> shared); |
| 249 | |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 250 | // Returns true if the current stub call is patched to call the debugger. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 251 | static bool IsDebugBreak(Address addr); |
sgjesse@chromium.org | 911335c | 2009-08-19 12:59:44 +0000 | [diff] [blame] | 252 | // Returns true if the current return statement has been patched to be |
| 253 | // a debugger breakpoint. |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 254 | static bool IsDebugBreakAtReturn(RelocInfo* rinfo); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 255 | |
| 256 | // Check whether a code stub with the specified major key is a possible break |
| 257 | // point location. |
| 258 | static bool IsSourceBreakStub(Code* code); |
| 259 | static bool IsBreakStub(Code* code); |
| 260 | |
| 261 | // Find the builtin to use for invoking the debug break |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 262 | static Handle<Code> FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 263 | |
| 264 | static Handle<Object> GetSourceBreakLocations( |
| 265 | Handle<SharedFunctionInfo> shared); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 266 | |
| 267 | // Getter for the debug_context. |
| 268 | inline static Handle<Context> debug_context() { return debug_context_; } |
| 269 | |
| 270 | // Check whether a global object is the debug global object. |
| 271 | static bool IsDebugGlobal(GlobalObject* global); |
| 272 | |
| 273 | // Fast check to see if any break points are active. |
| 274 | inline static bool has_break_points() { return has_break_points_; } |
| 275 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 276 | static void NewBreak(StackFrame::Id break_frame_id); |
| 277 | static void SetBreak(StackFrame::Id break_frame_id, int break_id); |
| 278 | static StackFrame::Id break_frame_id() { |
| 279 | return thread_local_.break_frame_id_; |
| 280 | } |
| 281 | static int break_id() { return thread_local_.break_id_; } |
| 282 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 283 | static bool StepInActive() { return thread_local_.step_into_fp_ != 0; } |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 284 | static void HandleStepIn(Handle<JSFunction> function, |
kasperl@chromium.org | defbd10 | 2009-07-13 14:04:26 +0000 | [diff] [blame] | 285 | Handle<Object> holder, |
christian.plesner.hansen@gmail.com | 37abdec | 2009-01-06 14:43:28 +0000 | [diff] [blame] | 286 | Address fp, |
| 287 | bool is_constructor); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 288 | static Address step_in_fp() { return thread_local_.step_into_fp_; } |
| 289 | static Address* step_in_fp_addr() { return &thread_local_.step_into_fp_; } |
| 290 | |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 291 | static bool StepOutActive() { return thread_local_.step_out_fp_ != 0; } |
| 292 | static Address step_out_fp() { return thread_local_.step_out_fp_; } |
| 293 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 294 | static EnterDebugger* debugger_entry() { |
| 295 | return thread_local_.debugger_entry_; |
| 296 | } |
| 297 | static void set_debugger_entry(EnterDebugger* entry) { |
| 298 | thread_local_.debugger_entry_ = entry; |
| 299 | } |
| 300 | |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 301 | // Check whether any of the specified interrupts are pending. |
| 302 | static bool is_interrupt_pending(InterruptFlag what) { |
| 303 | return (thread_local_.pending_interrupts_ & what) != 0; |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 304 | } |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 305 | |
| 306 | // Set specified interrupts as pending. |
| 307 | static void set_interrupts_pending(InterruptFlag what) { |
| 308 | thread_local_.pending_interrupts_ |= what; |
| 309 | } |
| 310 | |
| 311 | // Clear specified interrupts from pending. |
| 312 | static void clear_interrupt_pending(InterruptFlag what) { |
| 313 | thread_local_.pending_interrupts_ &= ~static_cast<int>(what); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 314 | } |
| 315 | |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 316 | // Getter and setter for the disable break state. |
| 317 | static bool disable_break() { return disable_break_; } |
| 318 | static void set_disable_break(bool disable_break) { |
| 319 | disable_break_ = disable_break; |
| 320 | } |
| 321 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 322 | // Getters for the current exception break state. |
| 323 | static bool break_on_exception() { return break_on_exception_; } |
| 324 | static bool break_on_uncaught_exception() { |
| 325 | return break_on_uncaught_exception_; |
| 326 | } |
| 327 | |
| 328 | enum AddressId { |
| 329 | k_after_break_target_address, |
| 330 | k_debug_break_return_address, |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 331 | k_debug_break_slot_address, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 332 | k_register_address |
| 333 | }; |
| 334 | |
| 335 | // Support for setting the address to jump to when returning from break point. |
| 336 | static Address* after_break_target_address() { |
| 337 | return reinterpret_cast<Address*>(&thread_local_.after_break_target_); |
| 338 | } |
| 339 | |
| 340 | // Support for saving/restoring registers when handling debug break calls. |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 341 | static Object** register_address(int r) { |
| 342 | return ®isters_[r]; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 343 | } |
| 344 | |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 345 | // Access to the debug break on return code. |
| 346 | static Code* debug_break_return() { return debug_break_return_; } |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 347 | static Code** debug_break_return_address() { |
| 348 | return &debug_break_return_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 349 | } |
| 350 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 351 | // Access to the debug break in debug break slot code. |
| 352 | static Code* debug_break_slot() { return debug_break_slot_; } |
| 353 | static Code** debug_break_slot_address() { |
| 354 | return &debug_break_slot_; |
| 355 | } |
| 356 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 357 | static const int kEstimatedNofDebugInfoEntries = 16; |
| 358 | static const int kEstimatedNofBreakPointsInFunction = 16; |
| 359 | |
kasperl@chromium.org | 5a8ca6c | 2008-10-23 13:57:19 +0000 | [diff] [blame] | 360 | static void HandleWeakDebugInfo(v8::Persistent<v8::Value> obj, void* data); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 361 | |
| 362 | friend class Debugger; |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 363 | friend Handle<FixedArray> GetDebuggedFunctions(); // In test-debug.cc |
| 364 | friend void CheckDebuggerUnloaded(bool check_functions); // In test-debug.cc |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 365 | |
| 366 | // Threading support. |
| 367 | static char* ArchiveDebug(char* to); |
| 368 | static char* RestoreDebug(char* from); |
| 369 | static int ArchiveSpacePerThread(); |
sgjesse@chromium.org | c514574 | 2009-10-07 09:00:33 +0000 | [diff] [blame] | 370 | static void FreeThreadResources() { } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 371 | |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 372 | // Mirror cache handling. |
| 373 | static void ClearMirrorCache(); |
| 374 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 375 | // Script cache handling. |
| 376 | static void CreateScriptCache(); |
| 377 | static void DestroyScriptCache(); |
| 378 | static void AddScriptToScriptCache(Handle<Script> script); |
| 379 | static Handle<FixedArray> GetLoadedScripts(); |
| 380 | |
| 381 | // Garbage collection notifications. |
| 382 | static void AfterGarbageCollection(); |
| 383 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 384 | // Code generator routines. |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 385 | static void GenerateSlot(MacroAssembler* masm); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 386 | static void GenerateLoadICDebugBreak(MacroAssembler* masm); |
| 387 | static void GenerateStoreICDebugBreak(MacroAssembler* masm); |
| 388 | static void GenerateKeyedLoadICDebugBreak(MacroAssembler* masm); |
| 389 | static void GenerateKeyedStoreICDebugBreak(MacroAssembler* masm); |
| 390 | static void GenerateConstructCallDebugBreak(MacroAssembler* masm); |
| 391 | static void GenerateReturnDebugBreak(MacroAssembler* masm); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 392 | static void GenerateStubNoRegistersDebugBreak(MacroAssembler* masm); |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 393 | static void GenerateSlotDebugBreak(MacroAssembler* masm); |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 394 | static void GeneratePlainReturnLiveEdit(MacroAssembler* masm); |
| 395 | static void GenerateFrameDropperLiveEdit(MacroAssembler* masm); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 396 | |
| 397 | // Called from stub-cache.cc. |
| 398 | static void GenerateCallICDebugBreak(MacroAssembler* masm); |
| 399 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 400 | static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id); |
| 401 | |
| 402 | static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
| 403 | Handle<Code> code); |
| 404 | static const int kFrameDropperFrameSize; |
| 405 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 406 | private: |
| 407 | static bool CompileDebuggerScript(int index); |
| 408 | static void ClearOneShot(); |
| 409 | static void ActivateStepIn(StackFrame* frame); |
| 410 | static void ClearStepIn(); |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 411 | static void ActivateStepOut(StackFrame* frame); |
| 412 | static void ClearStepOut(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 413 | static void ClearStepNext(); |
ager@chromium.org | 3291210 | 2009-01-16 10:38:43 +0000 | [diff] [blame] | 414 | // Returns whether the compile succeeded. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 415 | static void RemoveDebugInfo(Handle<DebugInfo> debug_info); |
| 416 | static void SetAfterBreakTarget(JavaScriptFrame* frame); |
| 417 | static Handle<Object> CheckBreakPoints(Handle<Object> break_point); |
| 418 | static bool CheckBreakPoint(Handle<Object> break_point_object); |
| 419 | |
| 420 | // Global handle to debug context where all the debugger JavaScript code is |
| 421 | // loaded. |
| 422 | static Handle<Context> debug_context_; |
| 423 | |
| 424 | // Boolean state indicating whether any break points are set. |
| 425 | static bool has_break_points_; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 426 | |
| 427 | // Cache of all scripts in the heap. |
| 428 | static ScriptCache* script_cache_; |
| 429 | |
| 430 | // List of active debug info objects. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 431 | static DebugInfoListNode* debug_info_list_; |
| 432 | |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 433 | static bool disable_break_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 434 | static bool break_on_exception_; |
| 435 | static bool break_on_uncaught_exception_; |
| 436 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 437 | // Per-thread data. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 438 | class ThreadLocal { |
| 439 | public: |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 440 | // Counter for generating next break id. |
| 441 | int break_count_; |
| 442 | |
| 443 | // Current break id. |
| 444 | int break_id_; |
| 445 | |
| 446 | // Frame id for the frame of the current break. |
| 447 | StackFrame::Id break_frame_id_; |
| 448 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 449 | // Step action for last step performed. |
| 450 | StepAction last_step_action_; |
| 451 | |
| 452 | // Source statement position from last step next action. |
| 453 | int last_statement_position_; |
| 454 | |
| 455 | // Number of steps left to perform before debug event. |
| 456 | int step_count_; |
| 457 | |
| 458 | // Frame pointer from last step next action. |
| 459 | Address last_fp_; |
| 460 | |
| 461 | // Frame pointer for frame from which step in was performed. |
| 462 | Address step_into_fp_; |
| 463 | |
ager@chromium.org | a1645e2 | 2009-09-09 19:27:10 +0000 | [diff] [blame] | 464 | // Frame pointer for the frame where debugger should be called when current |
| 465 | // step out action is completed. |
| 466 | Address step_out_fp_; |
| 467 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 468 | // Storage location for jump when exiting debug break calls. |
| 469 | Address after_break_target_; |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 470 | |
ager@chromium.org | 357bf65 | 2010-04-12 11:30:10 +0000 | [diff] [blame] | 471 | // Indicates that LiveEdit has patched the stack. |
| 472 | bool frames_are_dropped_; |
| 473 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 474 | // Top debugger entry. |
| 475 | EnterDebugger* debugger_entry_; |
| 476 | |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 477 | // Pending interrupts scheduled while debugging. |
| 478 | int pending_interrupts_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 479 | }; |
| 480 | |
| 481 | // Storage location for registers when handling debug break calls |
| 482 | static JSCallerSavedBuffer registers_; |
| 483 | static ThreadLocal thread_local_; |
| 484 | static void ThreadInit(); |
| 485 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 486 | // Code to call for handling debug break on return. |
| 487 | static Code* debug_break_return_; |
| 488 | |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 489 | // Code to call for handling debug break in debug break slots. |
| 490 | static Code* debug_break_slot_; |
| 491 | |
mads.s.ager@gmail.com | 9a4089a | 2008-09-01 08:55:01 +0000 | [diff] [blame] | 492 | DISALLOW_COPY_AND_ASSIGN(Debug); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 493 | }; |
| 494 | |
| 495 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 496 | // Message delivered to the message handler callback. This is either a debugger |
| 497 | // event or the response to a command. |
| 498 | class MessageImpl: public v8::Debug::Message { |
| 499 | public: |
| 500 | // Create a message object for a debug event. |
| 501 | static MessageImpl NewEvent(DebugEvent event, |
| 502 | bool running, |
| 503 | Handle<JSObject> exec_state, |
| 504 | Handle<JSObject> event_data); |
| 505 | |
| 506 | // Create a message object for the response to a debug command. |
| 507 | static MessageImpl NewResponse(DebugEvent event, |
| 508 | bool running, |
| 509 | Handle<JSObject> exec_state, |
| 510 | Handle<JSObject> event_data, |
| 511 | Handle<String> response_json, |
| 512 | v8::Debug::ClientData* client_data); |
| 513 | |
| 514 | // Implementation of interface v8::Debug::Message. |
| 515 | virtual bool IsEvent() const; |
| 516 | virtual bool IsResponse() const; |
| 517 | virtual DebugEvent GetEvent() const; |
| 518 | virtual bool WillStartRunning() const; |
| 519 | virtual v8::Handle<v8::Object> GetExecutionState() const; |
| 520 | virtual v8::Handle<v8::Object> GetEventData() const; |
| 521 | virtual v8::Handle<v8::String> GetJSON() const; |
| 522 | virtual v8::Handle<v8::Context> GetEventContext() const; |
| 523 | virtual v8::Debug::ClientData* GetClientData() const; |
| 524 | |
| 525 | private: |
| 526 | MessageImpl(bool is_event, |
| 527 | DebugEvent event, |
| 528 | bool running, |
| 529 | Handle<JSObject> exec_state, |
| 530 | Handle<JSObject> event_data, |
| 531 | Handle<String> response_json, |
| 532 | v8::Debug::ClientData* client_data); |
| 533 | |
| 534 | bool is_event_; // Does this message represent a debug event? |
| 535 | DebugEvent event_; // Debug event causing the break. |
| 536 | bool running_; // Will the VM start running after this event? |
| 537 | Handle<JSObject> exec_state_; // Current execution state. |
| 538 | Handle<JSObject> event_data_; // Data associated with the event. |
| 539 | Handle<String> response_json_; // Response JSON if message holds a response. |
| 540 | v8::Debug::ClientData* client_data_; // Client data passed with the request. |
| 541 | }; |
| 542 | |
| 543 | |
erik.corry@gmail.com | 9dfbea4 | 2010-05-21 12:58:28 +0000 | [diff] [blame] | 544 | // Details of the debug event delivered to the debug event listener. |
| 545 | class EventDetailsImpl : public v8::Debug::EventDetails { |
| 546 | public: |
| 547 | EventDetailsImpl(DebugEvent event, |
| 548 | Handle<JSObject> exec_state, |
| 549 | Handle<JSObject> event_data, |
| 550 | Handle<Object> callback_data); |
| 551 | virtual DebugEvent GetEvent() const; |
| 552 | virtual v8::Handle<v8::Object> GetExecutionState() const; |
| 553 | virtual v8::Handle<v8::Object> GetEventData() const; |
| 554 | virtual v8::Handle<v8::Context> GetEventContext() const; |
| 555 | virtual v8::Handle<v8::Value> GetCallbackData() const; |
| 556 | private: |
| 557 | DebugEvent event_; // Debug event causing the break. |
| 558 | Handle<JSObject> exec_state_; // Current execution state. |
| 559 | Handle<JSObject> event_data_; // Data associated with the event. |
| 560 | Handle<Object> callback_data_; // User data passed with the callback when |
| 561 | // it was registered. |
| 562 | }; |
| 563 | |
| 564 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 565 | // Message send by user to v8 debugger or debugger output message. |
| 566 | // In addition to command text it may contain a pointer to some user data |
| 567 | // which are expected to be passed along with the command reponse to message |
| 568 | // handler. |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 569 | class CommandMessage { |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 570 | public: |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 571 | static CommandMessage New(const Vector<uint16_t>& command, |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 572 | v8::Debug::ClientData* data); |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 573 | CommandMessage(); |
| 574 | ~CommandMessage(); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 575 | |
| 576 | // Deletes user data and disposes of the text. |
| 577 | void Dispose(); |
| 578 | Vector<uint16_t> text() const { return text_; } |
| 579 | v8::Debug::ClientData* client_data() const { return client_data_; } |
| 580 | private: |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 581 | CommandMessage(const Vector<uint16_t>& text, |
| 582 | v8::Debug::ClientData* data); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 583 | |
| 584 | Vector<uint16_t> text_; |
| 585 | v8::Debug::ClientData* client_data_; |
| 586 | }; |
| 587 | |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 588 | // A Queue of CommandMessage objects. A thread-safe version is |
| 589 | // LockingCommandMessageQueue, based on this class. |
| 590 | class CommandMessageQueue BASE_EMBEDDED { |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 591 | public: |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 592 | explicit CommandMessageQueue(int size); |
| 593 | ~CommandMessageQueue(); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 594 | bool IsEmpty() const { return start_ == end_; } |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 595 | CommandMessage Get(); |
| 596 | void Put(const CommandMessage& message); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 597 | void Clear() { start_ = end_ = 0; } // Queue is empty after Clear(). |
| 598 | private: |
| 599 | // Doubles the size of the message queue, and copies the messages. |
| 600 | void Expand(); |
| 601 | |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 602 | CommandMessage* messages_; |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 603 | int start_; |
| 604 | int end_; |
| 605 | int size_; // The size of the queue buffer. Queue can hold size-1 messages. |
| 606 | }; |
| 607 | |
| 608 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 609 | class MessageDispatchHelperThread; |
| 610 | |
| 611 | |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 612 | // LockingCommandMessageQueue is a thread-safe circular buffer of CommandMessage |
| 613 | // messages. The message data is not managed by LockingCommandMessageQueue. |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 614 | // Pointers to the data are passed in and out. Implemented by adding a |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 615 | // Mutex to CommandMessageQueue. Includes logging of all puts and gets. |
| 616 | class LockingCommandMessageQueue BASE_EMBEDDED { |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 617 | public: |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 618 | explicit LockingCommandMessageQueue(int size); |
| 619 | ~LockingCommandMessageQueue(); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 620 | bool IsEmpty() const; |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 621 | CommandMessage Get(); |
| 622 | void Put(const CommandMessage& message); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 623 | void Clear(); |
| 624 | private: |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 625 | CommandMessageQueue queue_; |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 626 | Mutex* lock_; |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 627 | DISALLOW_COPY_AND_ASSIGN(LockingCommandMessageQueue); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 628 | }; |
| 629 | |
| 630 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 631 | class Debugger { |
| 632 | public: |
| 633 | static void DebugRequest(const uint16_t* json_request, int length); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 634 | |
| 635 | static Handle<Object> MakeJSObject(Vector<const char> constructor_name, |
| 636 | int argc, Object*** argv, |
| 637 | bool* caught_exception); |
| 638 | static Handle<Object> MakeExecutionState(bool* caught_exception); |
| 639 | static Handle<Object> MakeBreakEvent(Handle<Object> exec_state, |
| 640 | Handle<Object> break_points_hit, |
| 641 | bool* caught_exception); |
| 642 | static Handle<Object> MakeExceptionEvent(Handle<Object> exec_state, |
| 643 | Handle<Object> exception, |
| 644 | bool uncaught, |
| 645 | bool* caught_exception); |
| 646 | static Handle<Object> MakeNewFunctionEvent(Handle<Object> func, |
| 647 | bool* caught_exception); |
| 648 | static Handle<Object> MakeCompileEvent(Handle<Script> script, |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 649 | bool before, |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 650 | bool* caught_exception); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 651 | static Handle<Object> MakeScriptCollectedEvent(int id, |
| 652 | bool* caught_exception); |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 653 | static void OnDebugBreak(Handle<Object> break_points_hit, bool auto_continue); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 654 | static void OnException(Handle<Object> exception, bool uncaught); |
| 655 | static void OnBeforeCompile(Handle<Script> script); |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 656 | |
| 657 | enum AfterCompileFlags { |
| 658 | NO_AFTER_COMPILE_FLAGS, |
| 659 | SEND_WHEN_DEBUGGING |
| 660 | }; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 661 | static void OnAfterCompile(Handle<Script> script, |
ager@chromium.org | ce5e87b | 2010-03-10 10:24:18 +0000 | [diff] [blame] | 662 | AfterCompileFlags after_compile_flags); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 663 | static void OnNewFunction(Handle<JSFunction> fun); |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 664 | static void OnScriptCollected(int id); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 665 | static void ProcessDebugEvent(v8::DebugEvent event, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 666 | Handle<JSObject> event_data, |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 667 | bool auto_continue); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 668 | static void NotifyMessageHandler(v8::DebugEvent event, |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 669 | Handle<JSObject> exec_state, |
| 670 | Handle<JSObject> event_data, |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 671 | bool auto_continue); |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 672 | static void SetEventListener(Handle<Object> callback, Handle<Object> data); |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 673 | static void SetMessageHandler(v8::Debug::MessageHandler2 handler); |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 674 | static void SetHostDispatchHandler(v8::Debug::HostDispatchHandler handler, |
| 675 | int period); |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 676 | static void SetDebugMessageDispatchHandler( |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 677 | v8::Debug::DebugMessageDispatchHandler handler, |
| 678 | bool provide_locker); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 679 | |
| 680 | // Invoke the message handler function. |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 681 | static void InvokeMessageHandler(MessageImpl message); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 682 | |
| 683 | // Add a debugger command to the command queue. |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 684 | static void ProcessCommand(Vector<const uint16_t> command, |
| 685 | v8::Debug::ClientData* client_data = NULL); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 686 | |
| 687 | // Check whether there are commands in the command queue. |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 688 | static bool HasCommands(); |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 689 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 690 | static Handle<Object> Call(Handle<JSFunction> fun, |
| 691 | Handle<Object> data, |
| 692 | bool* pending_exception); |
| 693 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 694 | // Start the debugger agent listening on the provided port. |
fschneider@chromium.org | 0c20e67 | 2010-01-14 15:28:53 +0000 | [diff] [blame] | 695 | static bool StartAgent(const char* name, int port, |
| 696 | bool wait_for_connection = false); |
ager@chromium.org | bb29dc9 | 2009-03-24 13:25:23 +0000 | [diff] [blame] | 697 | |
| 698 | // Stop the debugger agent. |
| 699 | static void StopAgent(); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 700 | |
sgjesse@chromium.org | c514574 | 2009-10-07 09:00:33 +0000 | [diff] [blame] | 701 | // Blocks until the agent has started listening for connections |
| 702 | static void WaitForAgent(); |
| 703 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 704 | static void CallMessageDispatchHandler(); |
| 705 | |
lrn@chromium.org | c34f580 | 2010-04-28 12:53:43 +0000 | [diff] [blame] | 706 | static Handle<Context> GetDebugContext(); |
| 707 | |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 708 | // Unload the debugger if possible. Only called when no debugger is currently |
| 709 | // active. |
| 710 | static void UnloadDebugger(); |
lrn@chromium.org | c34f580 | 2010-04-28 12:53:43 +0000 | [diff] [blame] | 711 | friend void ForceUnloadDebugger(); // In test-debug.cc |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 712 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 713 | inline static bool EventActive(v8::DebugEvent event) { |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 714 | ScopedLock with(debugger_access_); |
| 715 | |
| 716 | // Check whether the message handler was been cleared. |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 717 | if (debugger_unload_pending_) { |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 718 | if (Debug::debugger_entry() == NULL) { |
| 719 | UnloadDebugger(); |
| 720 | } |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 721 | } |
| 722 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 723 | // Currently argument event is not used. |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 724 | return !compiling_natives_ && Debugger::IsDebuggerActive(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 725 | } |
| 726 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 727 | static void set_compiling_natives(bool compiling_natives) { |
| 728 | Debugger::compiling_natives_ = compiling_natives; |
| 729 | } |
| 730 | static bool compiling_natives() { return Debugger::compiling_natives_; } |
mads.s.ager | cbaa060 | 2008-08-14 13:41:48 +0000 | [diff] [blame] | 731 | static void set_loading_debugger(bool v) { is_loading_debugger_ = v; } |
| 732 | static bool is_loading_debugger() { return Debugger::is_loading_debugger_; } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 733 | |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 734 | static bool IsDebuggerActive(); |
erik.corry@gmail.com | 9dfbea4 | 2010-05-21 12:58:28 +0000 | [diff] [blame] | 735 | |
| 736 | private: |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 737 | static void ListenersChanged(); |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 738 | |
| 739 | static Mutex* debugger_access_; // Mutex guarding debugger variables. |
| 740 | static Handle<Object> event_listener_; // Global handle to listener. |
iposva@chromium.org | 245aa85 | 2009-02-10 00:49:54 +0000 | [diff] [blame] | 741 | static Handle<Object> event_listener_data_; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 742 | static bool compiling_natives_; // Are we compiling natives? |
mads.s.ager | cbaa060 | 2008-08-14 13:41:48 +0000 | [diff] [blame] | 743 | static bool is_loading_debugger_; // Are we loading the debugger? |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 744 | static bool never_unload_debugger_; // Can we unload the debugger? |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 745 | static v8::Debug::MessageHandler2 message_handler_; |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 746 | static bool debugger_unload_pending_; // Was message handler cleared? |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 747 | static v8::Debug::HostDispatchHandler host_dispatch_handler_; |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 748 | static Mutex* dispatch_handler_access_; // Mutex guarding dispatch handler. |
ager@chromium.org | c4c9272 | 2009-11-18 14:12:51 +0000 | [diff] [blame] | 749 | static v8::Debug::DebugMessageDispatchHandler debug_message_dispatch_handler_; |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 750 | static MessageDispatchHelperThread* message_dispatch_helper_thread_; |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 751 | static int host_dispatch_micros_; |
ager@chromium.org | 381abbb | 2009-02-25 13:23:22 +0000 | [diff] [blame] | 752 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 753 | static DebuggerAgent* agent_; |
| 754 | |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 755 | static const int kQueueInitialSize = 4; |
ager@chromium.org | 3a37e9b | 2009-04-27 09:26:21 +0000 | [diff] [blame] | 756 | static LockingCommandMessageQueue command_queue_; |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 757 | static Semaphore* command_received_; // Signaled for each command received. |
ager@chromium.org | 41826e7 | 2009-03-30 13:30:57 +0000 | [diff] [blame] | 758 | |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 759 | friend class EnterDebugger; |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 760 | }; |
| 761 | |
| 762 | |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 763 | // This class is used for entering the debugger. Create an instance in the stack |
| 764 | // to enter the debugger. This will set the current break state, make sure the |
| 765 | // debugger is loaded and switch to the debugger context. If the debugger for |
| 766 | // some reason could not be entered FailedToEnter will return true. |
| 767 | class EnterDebugger BASE_EMBEDDED { |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 768 | public: |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 769 | EnterDebugger() |
| 770 | : prev_(Debug::debugger_entry()), |
| 771 | has_js_frames_(!it_.done()) { |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 772 | ASSERT(prev_ != NULL || !Debug::is_interrupt_pending(PREEMPT)); |
| 773 | ASSERT(prev_ != NULL || !Debug::is_interrupt_pending(DEBUGBREAK)); |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 774 | |
| 775 | // Link recursive debugger entry. |
| 776 | Debug::set_debugger_entry(this); |
| 777 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 778 | // Store the previous break id and frame id. |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 779 | break_id_ = Debug::break_id(); |
| 780 | break_frame_id_ = Debug::break_frame_id(); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 781 | |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 782 | // Create the new break info. If there is no JavaScript frames there is no |
| 783 | // break frame id. |
| 784 | if (has_js_frames_) { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 785 | Debug::NewBreak(it_.frame()->id()); |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 786 | } else { |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 787 | Debug::NewBreak(StackFrame::NO_ID); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 788 | } |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 789 | |
| 790 | // Make sure that debugger is loaded and enter the debugger context. |
| 791 | load_failed_ = !Debug::Load(); |
| 792 | if (!load_failed_) { |
| 793 | // NOTE the member variable save which saves the previous context before |
| 794 | // this change. |
| 795 | Top::set_context(*Debug::debug_context()); |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 796 | } |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 797 | } |
| 798 | |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 799 | ~EnterDebugger() { |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 800 | // Restore to the previous break state. |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 801 | Debug::SetBreak(break_frame_id_, break_id_); |
| 802 | |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 803 | // Check for leaving the debugger. |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 804 | if (prev_ == NULL) { |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 805 | // Clear mirror cache when leaving the debugger. Skip this if there is a |
| 806 | // pending exception as clearing the mirror cache calls back into |
| 807 | // JavaScript. This can happen if the v8::Debug::Call is used in which |
| 808 | // case the exception should end up in the calling code. |
| 809 | if (!Top::has_pending_exception()) { |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 810 | // Try to avoid any pending debug break breaking in the clear mirror |
| 811 | // cache JavaScript code. |
| 812 | if (StackGuard::IsDebugBreak()) { |
| 813 | Debug::set_interrupts_pending(DEBUGBREAK); |
| 814 | StackGuard::Continue(DEBUGBREAK); |
| 815 | } |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 816 | Debug::ClearMirrorCache(); |
| 817 | } |
sgjesse@chromium.org | 755c5b1 | 2009-05-29 11:04:38 +0000 | [diff] [blame] | 818 | |
| 819 | // Request preemption and debug break when leaving the last debugger entry |
| 820 | // if any of these where recorded while debugging. |
| 821 | if (Debug::is_interrupt_pending(PREEMPT)) { |
| 822 | // This re-scheduling of preemption is to avoid starvation in some |
| 823 | // debugging scenarios. |
| 824 | Debug::clear_interrupt_pending(PREEMPT); |
| 825 | StackGuard::Preempt(); |
| 826 | } |
| 827 | if (Debug::is_interrupt_pending(DEBUGBREAK)) { |
| 828 | Debug::clear_interrupt_pending(DEBUGBREAK); |
| 829 | StackGuard::DebugBreak(); |
| 830 | } |
| 831 | |
| 832 | // If there are commands in the queue when leaving the debugger request |
| 833 | // that these commands are processed. |
| 834 | if (Debugger::HasCommands()) { |
| 835 | StackGuard::DebugCommand(); |
| 836 | } |
| 837 | |
kasperl@chromium.org | 71affb5 | 2009-05-26 05:44:31 +0000 | [diff] [blame] | 838 | // If leaving the debugger with the debugger no longer active unload it. |
ager@chromium.org | 71daaf6 | 2009-04-01 07:22:49 +0000 | [diff] [blame] | 839 | if (!Debugger::IsDebuggerActive()) { |
| 840 | Debugger::UnloadDebugger(); |
| 841 | } |
| 842 | } |
| 843 | |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 844 | // Leaving this debugger entry. |
| 845 | Debug::set_debugger_entry(prev_); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 846 | } |
| 847 | |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 848 | // Check whether the debugger could be entered. |
| 849 | inline bool FailedToEnter() { return load_failed_; } |
| 850 | |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 851 | // Check whether there are any JavaScript frames on the stack. |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 852 | inline bool HasJavaScriptFrames() { return has_js_frames_; } |
ager@chromium.org | a74f0da | 2008-12-03 16:05:52 +0000 | [diff] [blame] | 853 | |
ager@chromium.org | 9085a01 | 2009-05-11 19:22:57 +0000 | [diff] [blame] | 854 | // Get the active context from before entering the debugger. |
| 855 | inline Handle<Context> GetContext() { return save_.context(); } |
| 856 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 857 | private: |
kasperl@chromium.org | 7be3c99 | 2009-03-12 07:19:55 +0000 | [diff] [blame] | 858 | EnterDebugger* prev_; // Previous debugger entry if entered recursively. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 859 | JavaScriptFrameIterator it_; |
ager@chromium.org | 8bb6058 | 2008-12-11 12:02:20 +0000 | [diff] [blame] | 860 | const bool has_js_frames_; // Were there any JavaScript frames? |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 861 | StackFrame::Id break_frame_id_; // Previous break frame id. |
| 862 | int break_id_; // Previous break id. |
kasperl@chromium.org | 41044eb | 2008-10-06 08:24:46 +0000 | [diff] [blame] | 863 | bool load_failed_; // Did the debugger fail to load? |
| 864 | SaveContext save_; // Saves previous context. |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 865 | }; |
| 866 | |
| 867 | |
kasper.lund | bd3ec4e | 2008-07-09 11:06:54 +0000 | [diff] [blame] | 868 | // Stack allocated class for disabling break. |
| 869 | class DisableBreak BASE_EMBEDDED { |
| 870 | public: |
| 871 | // Enter the debugger by storing the previous top context and setting the |
| 872 | // current top context to the debugger context. |
| 873 | explicit DisableBreak(bool disable_break) { |
| 874 | prev_disable_break_ = Debug::disable_break(); |
| 875 | Debug::set_disable_break(disable_break); |
| 876 | } |
| 877 | ~DisableBreak() { |
| 878 | Debug::set_disable_break(prev_disable_break_); |
| 879 | } |
| 880 | |
| 881 | private: |
| 882 | // The previous state of the disable break used to restore the value when this |
| 883 | // object is destructed. |
| 884 | bool prev_disable_break_; |
| 885 | }; |
| 886 | |
| 887 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 888 | // Debug_Address encapsulates the Address pointers used in generating debug |
| 889 | // code. |
| 890 | class Debug_Address { |
| 891 | public: |
| 892 | Debug_Address(Debug::AddressId id, int reg = 0) |
| 893 | : id_(id), reg_(reg) { |
| 894 | ASSERT(reg == 0 || id == Debug::k_register_address); |
| 895 | } |
| 896 | |
| 897 | static Debug_Address AfterBreakTarget() { |
| 898 | return Debug_Address(Debug::k_after_break_target_address); |
| 899 | } |
| 900 | |
| 901 | static Debug_Address DebugBreakReturn() { |
| 902 | return Debug_Address(Debug::k_debug_break_return_address); |
| 903 | } |
| 904 | |
| 905 | static Debug_Address Register(int reg) { |
| 906 | return Debug_Address(Debug::k_register_address, reg); |
| 907 | } |
| 908 | |
| 909 | Address address() const { |
| 910 | switch (id_) { |
| 911 | case Debug::k_after_break_target_address: |
| 912 | return reinterpret_cast<Address>(Debug::after_break_target_address()); |
| 913 | case Debug::k_debug_break_return_address: |
| 914 | return reinterpret_cast<Address>(Debug::debug_break_return_address()); |
vegorov@chromium.org | 2356e6f | 2010-06-09 09:38:56 +0000 | [diff] [blame^] | 915 | case Debug::k_debug_break_slot_address: |
| 916 | return reinterpret_cast<Address>(Debug::debug_break_slot_address()); |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 917 | case Debug::k_register_address: |
| 918 | return reinterpret_cast<Address>(Debug::register_address(reg_)); |
| 919 | default: |
| 920 | UNREACHABLE(); |
| 921 | return NULL; |
| 922 | } |
| 923 | } |
| 924 | private: |
| 925 | Debug::AddressId id_; |
| 926 | int reg_; |
| 927 | }; |
| 928 | |
sgjesse@chromium.org | b302e56 | 2010-02-03 11:26:59 +0000 | [diff] [blame] | 929 | // The optional thread that Debug Agent may use to temporary call V8 to process |
| 930 | // pending debug requests if debuggee is not running V8 at the moment. |
| 931 | // Techincally it does not call V8 itself, rather it asks embedding program |
| 932 | // to do this via v8::Debug::HostDispatchHandler |
| 933 | class MessageDispatchHelperThread: public Thread { |
| 934 | public: |
| 935 | MessageDispatchHelperThread(); |
| 936 | ~MessageDispatchHelperThread(); |
| 937 | |
| 938 | void Schedule(); |
| 939 | |
| 940 | private: |
| 941 | void Run(); |
| 942 | |
| 943 | Semaphore* const sem_; |
| 944 | Mutex* const mutex_; |
| 945 | bool already_signalled_; |
| 946 | |
| 947 | DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
| 948 | }; |
| 949 | |
christian.plesner.hansen | 43d26ec | 2008-07-03 15:10:15 +0000 | [diff] [blame] | 950 | |
| 951 | } } // namespace v8::internal |
| 952 | |
ager@chromium.org | 65dad4b | 2009-04-23 08:48:43 +0000 | [diff] [blame] | 953 | #endif // ENABLE_DEBUGGER_SUPPORT |
| 954 | |
ager@chromium.org | 5ec4892 | 2009-05-05 07:25:34 +0000 | [diff] [blame] | 955 | #endif // V8_DEBUG_H_ |