OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 Debug::set_interrupts_pending(PREEMPT); | 885 Debug::set_interrupts_pending(PREEMPT); |
886 } | 886 } |
887 | 887 |
888 | 888 |
889 void Debug::Iterate(ObjectVisitor* v) { | 889 void Debug::Iterate(ObjectVisitor* v) { |
890 v->VisitPointer(BitCast<Object**>(&(debug_break_return_))); | 890 v->VisitPointer(BitCast<Object**>(&(debug_break_return_))); |
891 v->VisitPointer(BitCast<Object**>(&(debug_break_slot_))); | 891 v->VisitPointer(BitCast<Object**>(&(debug_break_slot_))); |
892 } | 892 } |
893 | 893 |
894 | 894 |
895 void Debug::PutValuesOnStackAndDie(int start, | |
896 Address c_entry_fp, | |
897 Address last_fp, | |
898 Address larger_fp, | |
899 int count, | |
900 int end) { | |
901 OS::Abort(); | |
902 } | |
903 | |
904 | |
905 Object* Debug::Break(Arguments args) { | 895 Object* Debug::Break(Arguments args) { |
906 Heap* heap = isolate_->heap(); | 896 Heap* heap = isolate_->heap(); |
907 HandleScope scope(isolate_); | 897 HandleScope scope(isolate_); |
908 ASSERT(args.length() == 0); | 898 ASSERT(args.length() == 0); |
909 | 899 |
910 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED; | 900 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED; |
911 | 901 |
912 // Get the top-most JavaScript frame. | 902 // Get the top-most JavaScript frame. |
913 JavaScriptFrameIterator it(isolate_); | 903 JavaScriptFrameIterator it(isolate_); |
914 JavaScriptFrame* frame = it.frame(); | 904 JavaScriptFrame* frame = it.frame(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
992 // and keep step count queued up in the meantime. | 982 // and keep step count queued up in the meantime. |
993 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) { | 983 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) { |
994 // Count frames until target frame | 984 // Count frames until target frame |
995 int count = 0; | 985 int count = 0; |
996 JavaScriptFrameIterator it(isolate_); | 986 JavaScriptFrameIterator it(isolate_); |
997 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) { | 987 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) { |
998 count++; | 988 count++; |
999 it.Advance(); | 989 it.Advance(); |
1000 } | 990 } |
1001 | 991 |
1002 // Catch the cases that would lead to crashes and capture | 992 // Check that we indeed found the frame we are looking for. |
1003 // - C entry FP at which to start stack crawl. | 993 CHECK(!it.done() && (it.frame()->fp() == thread_local_.last_fp_)); |
1004 // - FP of the frame at which we plan to stop stepping out (last FP). | 994 if (step_count > 1) { |
1005 // - current FP that's larger than last FP. | 995 // Save old count and action to continue stepping after |
1006 // - Counter for the number of steps to step out. | 996 // StepOut |
1007 if (it.done()) { | 997 thread_local_.queued_step_count_ = step_count - 1; |
1008 // We crawled the entire stack, never reaching last_fp_. | |
1009 PutValuesOnStackAndDie(0xBEEEEEEE, | |
1010 frame->fp(), | |
1011 thread_local_.last_fp_, | |
1012 NULL, | |
1013 count, | |
1014 0xFEEEEEEE); | |
1015 } else if (it.frame()->fp() != thread_local_.last_fp_) { | |
1016 // We crawled over last_fp_, without getting a match. | |
1017 PutValuesOnStackAndDie(0xBEEEEEEE, | |
1018 frame->fp(), | |
1019 thread_local_.last_fp_, | |
1020 it.frame()->fp(), | |
1021 count, | |
1022 0xFEEEEEEE); | |
1023 } | 998 } |
1024 | 999 |
1025 // If we found original frame | 1000 // Set up for StepOut to reach target frame |
1026 if (it.frame()->fp() == thread_local_.last_fp_) { | 1001 step_action = StepOut; |
1027 if (step_count > 1) { | 1002 step_count = count; |
1028 // Save old count and action to continue stepping after | |
1029 // StepOut | |
1030 thread_local_.queued_step_count_ = step_count - 1; | |
1031 } | |
1032 | |
1033 // Set up for StepOut to reach target frame | |
1034 step_action = StepOut; | |
1035 step_count = count; | |
1036 } | |
1037 } | 1003 } |
1038 | 1004 |
1039 // Clear all current stepping setup. | 1005 // Clear all current stepping setup. |
1040 ClearStepping(); | 1006 ClearStepping(); |
1041 | 1007 |
1042 // Set up for the remaining steps. | 1008 // Set up for the remaining steps. |
1043 PrepareStep(step_action, step_count); | 1009 PrepareStep(step_action, step_count); |
1044 } | 1010 } |
1045 | 1011 |
1046 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { | 1012 if (thread_local_.frame_drop_mode_ == FRAMES_UNTOUCHED) { |
(...skipping 2574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3621 { | 3587 { |
3622 Locker locker; | 3588 Locker locker; |
3623 Isolate::Current()->debugger()->CallMessageDispatchHandler(); | 3589 Isolate::Current()->debugger()->CallMessageDispatchHandler(); |
3624 } | 3590 } |
3625 } | 3591 } |
3626 } | 3592 } |
3627 | 3593 |
3628 #endif // ENABLE_DEBUGGER_SUPPORT | 3594 #endif // ENABLE_DEBUGGER_SUPPORT |
3629 | 3595 |
3630 } } // namespace v8::internal | 3596 } } // namespace v8::internal |
OLD | NEW |