Index: src/debug.cc |
=================================================================== |
--- src/debug.cc (revision 4834) |
+++ src/debug.cc (working copy) |
@@ -1713,6 +1713,40 @@ |
} |
+bool Debug::IsBreakAtReturn(JavaScriptFrame* frame) { |
+ HandleScope scope; |
+ |
+ // Get the executing function in which the debug break occurred. |
+ Handle<SharedFunctionInfo> shared = |
+ Handle<SharedFunctionInfo>(JSFunction::cast(frame->function())->shared()); |
+ if (!EnsureDebugInfo(shared)) { |
+ // Return if we failed to retrieve the debug info. |
+ return false; |
+ } |
+ Handle<DebugInfo> debug_info = GetDebugInfo(shared); |
+ Handle<Code> code(debug_info->code()); |
+#ifdef DEBUG |
+ // Get the code which is actually executing. |
+ Handle<Code> frame_code(frame->code()); |
+ ASSERT(frame_code.is_identical_to(code)); |
+#endif |
+ |
+ // Find the call address in the running code. |
+ Address addr = frame->pc() - Assembler::kCallTargetAddressOffset; |
+ |
+ // Check if the location is at JS return. |
+ RelocIterator it(debug_info->code()); |
+ while (!it.done()) { |
+ if (RelocInfo::IsJSReturn(it.rinfo()->rmode())) { |
+ return (it.rinfo()->pc() == |
+ addr - Assembler::kPatchReturnSequenceAddressOffset); |
+ } |
+ it.next(); |
+ } |
+ return false; |
+} |
+ |
+ |
void Debug::FramesHaveBeenDropped(StackFrame::Id new_break_frame_id) { |
thread_local_.frames_are_dropped_ = true; |
thread_local_.break_frame_id_ = new_break_frame_id; |