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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // Getters for the current exception break state. | 325 // Getters for the current exception break state. |
326 static bool break_on_exception() { return break_on_exception_; } | 326 static bool break_on_exception() { return break_on_exception_; } |
327 static bool break_on_uncaught_exception() { | 327 static bool break_on_uncaught_exception() { |
328 return break_on_uncaught_exception_; | 328 return break_on_uncaught_exception_; |
329 } | 329 } |
330 | 330 |
331 enum AddressId { | 331 enum AddressId { |
332 k_after_break_target_address, | 332 k_after_break_target_address, |
333 k_debug_break_return_address, | 333 k_debug_break_return_address, |
334 k_debug_break_slot_address, | 334 k_debug_break_slot_address, |
| 335 k_restarter_frame_function_pointer, |
335 k_register_address | 336 k_register_address |
336 }; | 337 }; |
337 | 338 |
338 // Support for setting the address to jump to when returning from break point. | 339 // Support for setting the address to jump to when returning from break point. |
339 static Address* after_break_target_address() { | 340 static Address* after_break_target_address() { |
340 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); | 341 return reinterpret_cast<Address*>(&thread_local_.after_break_target_); |
341 } | 342 } |
| 343 static Address* restarter_frame_function_pointer_address() { |
| 344 Object*** address = &thread_local_.restarter_frame_function_pointer_; |
| 345 return reinterpret_cast<Address*>(address); |
| 346 } |
342 | 347 |
343 // Support for saving/restoring registers when handling debug break calls. | 348 // Support for saving/restoring registers when handling debug break calls. |
344 static Object** register_address(int r) { | 349 static Object** register_address(int r) { |
345 return ®isters_[r]; | 350 return ®isters_[r]; |
346 } | 351 } |
347 | 352 |
348 // Access to the debug break on return code. | 353 // Access to the debug break on return code. |
349 static Code* debug_break_return() { return debug_break_return_; } | 354 static Code* debug_break_return() { return debug_break_return_; } |
350 static Code** debug_break_return_address() { | 355 static Code** debug_break_return_address() { |
351 return &debug_break_return_; | 356 return &debug_break_return_; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 FRAME_DROPPED_IN_IC_CALL, | 413 FRAME_DROPPED_IN_IC_CALL, |
409 // The top JS frame had been calling debug break slot stub. Patch the | 414 // The top JS frame had been calling debug break slot stub. Patch the |
410 // address this stub jumps to in the end. | 415 // address this stub jumps to in the end. |
411 FRAME_DROPPED_IN_DEBUG_SLOT_CALL, | 416 FRAME_DROPPED_IN_DEBUG_SLOT_CALL, |
412 // The top JS frame had been calling some C++ function. The return address | 417 // The top JS frame had been calling some C++ function. The return address |
413 // gets patched automatically. | 418 // gets patched automatically. |
414 FRAME_DROPPED_IN_DIRECT_CALL | 419 FRAME_DROPPED_IN_DIRECT_CALL |
415 }; | 420 }; |
416 | 421 |
417 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, | 422 static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id, |
418 FrameDropMode mode); | 423 FrameDropMode mode, |
| 424 Object** restarter_frame_function_pointer); |
419 | 425 |
420 static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame, | 426 // Initializes an artificial stack frame. The data it contains is used for: |
421 Handle<Code> code); | 427 // a. successful work of frame dropper code which eventually gets control, |
| 428 // b. being compatible with regular stack structure for various stack |
| 429 // iterators. |
| 430 // Returns address of stack allocated pointer to restarted function, |
| 431 // the value that is called 'restarter_frame_function_pointer'. The value |
| 432 // at this address (possibly updated by GC) may be used later when preparing |
| 433 // 'step in' operation. |
| 434 // The implementation is architecture-specific. |
| 435 // TODO(LiveEdit): consider reviewing it as architecture-independent. |
| 436 static Object** SetUpFrameDropperFrame(StackFrame* bottom_js_frame, |
| 437 Handle<Code> code); |
| 438 |
422 static const int kFrameDropperFrameSize; | 439 static const int kFrameDropperFrameSize; |
423 | 440 |
424 private: | 441 private: |
425 static bool CompileDebuggerScript(int index); | 442 static bool CompileDebuggerScript(int index); |
426 static void ClearOneShot(); | 443 static void ClearOneShot(); |
427 static void ActivateStepIn(StackFrame* frame); | 444 static void ActivateStepIn(StackFrame* frame); |
428 static void ClearStepIn(); | 445 static void ClearStepIn(); |
429 static void ActivateStepOut(StackFrame* frame); | 446 static void ActivateStepOut(StackFrame* frame); |
430 static void ClearStepOut(); | 447 static void ClearStepOut(); |
431 static void ClearStepNext(); | 448 static void ClearStepNext(); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 505 |
489 // Stores the way how LiveEdit has patched the stack. It is used when | 506 // Stores the way how LiveEdit has patched the stack. It is used when |
490 // debugger returns control back to user script. | 507 // debugger returns control back to user script. |
491 FrameDropMode frame_drop_mode_; | 508 FrameDropMode frame_drop_mode_; |
492 | 509 |
493 // Top debugger entry. | 510 // Top debugger entry. |
494 EnterDebugger* debugger_entry_; | 511 EnterDebugger* debugger_entry_; |
495 | 512 |
496 // Pending interrupts scheduled while debugging. | 513 // Pending interrupts scheduled while debugging. |
497 int pending_interrupts_; | 514 int pending_interrupts_; |
| 515 |
| 516 // When restarter frame is on stack, stores the address |
| 517 // of the pointer to function being restarted. Otherwise (most of the time) |
| 518 // stores NULL. This pointer is used with 'step in' implementation. |
| 519 Object** restarter_frame_function_pointer_; |
498 }; | 520 }; |
499 | 521 |
500 // Storage location for registers when handling debug break calls | 522 // Storage location for registers when handling debug break calls |
501 static JSCallerSavedBuffer registers_; | 523 static JSCallerSavedBuffer registers_; |
502 static ThreadLocal thread_local_; | 524 static ThreadLocal thread_local_; |
503 static void ThreadInit(); | 525 static void ThreadInit(); |
504 | 526 |
505 // Code to call for handling debug break on return. | 527 // Code to call for handling debug break on return. |
506 static Code* debug_break_return_; | 528 static Code* debug_break_return_; |
507 | 529 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
931 } | 953 } |
932 | 954 |
933 static Debug_Address AfterBreakTarget() { | 955 static Debug_Address AfterBreakTarget() { |
934 return Debug_Address(Debug::k_after_break_target_address); | 956 return Debug_Address(Debug::k_after_break_target_address); |
935 } | 957 } |
936 | 958 |
937 static Debug_Address DebugBreakReturn() { | 959 static Debug_Address DebugBreakReturn() { |
938 return Debug_Address(Debug::k_debug_break_return_address); | 960 return Debug_Address(Debug::k_debug_break_return_address); |
939 } | 961 } |
940 | 962 |
| 963 static Debug_Address RestarterFrameFunctionPointer() { |
| 964 return Debug_Address(Debug::k_restarter_frame_function_pointer); |
| 965 } |
| 966 |
941 static Debug_Address Register(int reg) { | 967 static Debug_Address Register(int reg) { |
942 return Debug_Address(Debug::k_register_address, reg); | 968 return Debug_Address(Debug::k_register_address, reg); |
943 } | 969 } |
944 | 970 |
945 Address address() const { | 971 Address address() const { |
946 switch (id_) { | 972 switch (id_) { |
947 case Debug::k_after_break_target_address: | 973 case Debug::k_after_break_target_address: |
948 return reinterpret_cast<Address>(Debug::after_break_target_address()); | 974 return reinterpret_cast<Address>(Debug::after_break_target_address()); |
949 case Debug::k_debug_break_return_address: | 975 case Debug::k_debug_break_return_address: |
950 return reinterpret_cast<Address>(Debug::debug_break_return_address()); | 976 return reinterpret_cast<Address>(Debug::debug_break_return_address()); |
951 case Debug::k_debug_break_slot_address: | 977 case Debug::k_debug_break_slot_address: |
952 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); | 978 return reinterpret_cast<Address>(Debug::debug_break_slot_address()); |
| 979 case Debug::k_restarter_frame_function_pointer: |
| 980 return reinterpret_cast<Address>( |
| 981 Debug::restarter_frame_function_pointer_address()); |
953 case Debug::k_register_address: | 982 case Debug::k_register_address: |
954 return reinterpret_cast<Address>(Debug::register_address(reg_)); | 983 return reinterpret_cast<Address>(Debug::register_address(reg_)); |
955 default: | 984 default: |
956 UNREACHABLE(); | 985 UNREACHABLE(); |
957 return NULL; | 986 return NULL; |
958 } | 987 } |
959 } | 988 } |
960 private: | 989 private: |
961 Debug::AddressId id_; | 990 Debug::AddressId id_; |
962 int reg_; | 991 int reg_; |
(...skipping 19 matching lines...) Expand all Loading... |
982 | 1011 |
983 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); | 1012 DISALLOW_COPY_AND_ASSIGN(MessageDispatchHelperThread); |
984 }; | 1013 }; |
985 | 1014 |
986 | 1015 |
987 } } // namespace v8::internal | 1016 } } // namespace v8::internal |
988 | 1017 |
989 #endif // ENABLE_DEBUGGER_SUPPORT | 1018 #endif // ENABLE_DEBUGGER_SUPPORT |
990 | 1019 |
991 #endif // V8_DEBUG_H_ | 1020 #endif // V8_DEBUG_H_ |
OLD | NEW |