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 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 } else { | 1706 } else { |
1707 // There is no longer a break point present. Don't try to look in the | 1707 // There is no longer a break point present. Don't try to look in the |
1708 // original code as the running code will have the right address. This takes | 1708 // original code as the running code will have the right address. This takes |
1709 // care of the case where the last break point is removed from the function | 1709 // care of the case where the last break point is removed from the function |
1710 // and therefore no "original code" is available. | 1710 // and therefore no "original code" is available. |
1711 thread_local_.after_break_target_ = Assembler::target_address_at(addr); | 1711 thread_local_.after_break_target_ = Assembler::target_address_at(addr); |
1712 } | 1712 } |
1713 } | 1713 } |
1714 | 1714 |
1715 | 1715 |
| 1716 bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) { |
| 1717 HandleScope scope; |
| 1718 |
| 1719 // Get the executing function in which the debug break occurred. |
| 1720 Handle<SharedFunctionInfo> shared = |
| 1721 Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared()); |
| 1722 if (!EnsureDebugInfo(shared)) { |
| 1723 // Return if we failed to retrieve the debug info. |
| 1724 return false; |
| 1725 } |
| 1726 Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
| 1727 Handle<Code> code(debug_info->code()); |
| 1728 #ifdef DEBUG |
| 1729 // Get the code which is actually executing. |
| 1730 Handle<Code> frame_code(frame->code()); |
| 1731 ASSERT(frame_code.is_identical_to(code)); |
| 1732 #endif |
| 1733 |
| 1734 // Find the call address in the running code. |
| 1735 Address addr = frame->pc() - Assembler::kCallTargetAddressOffset; |
| 1736 |
| 1737 // Check if the location is at JS return. |
| 1738 RelocIterator it(debug_info->code()); |
| 1739 while (!it.done()) { |
| 1740 if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) { |
| 1741 return (it.rinfo()->pc() == |
| 1742 addr - Assembler::kPatchReturnSequenceAddressOffset); |
| 1743 } |
| 1744 it.next(); |
| 1745 } |
| 1746 return false; |
| 1747 } |
| 1748 |
| 1749 |
1716 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id) { | 1750 void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id) { |
1717 thread_local_.frames_are_dropped_ = true; | 1751 thread_local_.frames_are_dropped_ = true; |
1718 thread_local_.break_frame_id_ = new_break_frame_id; | 1752 thread_local_.break_frame_id_ = new_break_frame_id; |
1719 } | 1753 } |
1720 | 1754 |
1721 | 1755 |
1722 bool Debug::IsDebugGlobal(GlobalObject* global) { | 1756 bool Debug::IsDebugGlobal(GlobalObject* global) { |
1723 return IsLoaded() && global == Debug::debug_context()->global(); | 1757 return IsLoaded() && global == Debug::debug_context()->global(); |
1724 } | 1758 } |
1725 | 1759 |
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2886 { | 2920 { |
2887 Locker locker; | 2921 Locker locker; |
2888 Debugger::CallMessageDispatchHandler(); | 2922 Debugger::CallMessageDispatchHandler(); |
2889 } | 2923 } |
2890 } | 2924 } |
2891 } | 2925 } |
2892 | 2926 |
2893 #endif // ENABLE_DEBUGGER_SUPPORT | 2927 #endif // ENABLE_DEBUGGER_SUPPORT |
2894 | 2928 |
2895 } } // namespace v8::internal | 2929 } } // namespace v8::internal |
OLD | NEW |