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