Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1229)

Side by Side Diff: src/debug.cc

Issue 10375009: Intercept a crash, put debug information onto the stack and then abort gracefully. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
895 Object* Debug::Break(Arguments args) { 905 Object* Debug::Break(Arguments args) {
896 Heap* heap = isolate_->heap(); 906 Heap* heap = isolate_->heap();
897 HandleScope scope(isolate_); 907 HandleScope scope(isolate_);
898 ASSERT(args.length() == 0); 908 ASSERT(args.length() == 0);
899 909
900 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED; 910 thread_local_.frame_drop_mode_ = FRAMES_UNTOUCHED;
901 911
902 // Get the top-most JavaScript frame. 912 // Get the top-most JavaScript frame.
903 JavaScriptFrameIterator it(isolate_); 913 JavaScriptFrameIterator it(isolate_);
904 JavaScriptFrame* frame = it.frame(); 914 JavaScriptFrame* frame = it.frame();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 // ClearStepping. 987 // ClearStepping.
978 StepAction step_action = thread_local_.last_step_action_; 988 StepAction step_action = thread_local_.last_step_action_;
979 int step_count = thread_local_.step_count_; 989 int step_count = thread_local_.step_count_;
980 990
981 // If StepNext goes deeper in code, StepOut until original frame 991 // If StepNext goes deeper in code, StepOut until original frame
982 // and keep step count queued up in the meantime. 992 // and keep step count queued up in the meantime.
983 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) { 993 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) {
984 // Count frames until target frame 994 // Count frames until target frame
985 int count = 0; 995 int count = 0;
986 JavaScriptFrameIterator it(isolate_); 996 JavaScriptFrameIterator it(isolate_);
987 while (!it.done() && it.frame()->fp() != thread_local_.last_fp_) { 997 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) {
988 count++; 998 count++;
989 it.Advance(); 999 it.Advance();
990 } 1000 }
991 1001
1002 // Catch the cases that would lead to crashes and capture
1003 // - C entry FP at which to start stack crawl.
1004 // - FP of the frame at which we plan to stop stepping out (last FP).
1005 // - current FP that's larger than last FP.
1006 // - Counter for the number of steps to step out.
1007 if (it.done()) {
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 }
1024
992 // If we found original frame 1025 // If we found original frame
993 if (it.frame()->fp() == thread_local_.last_fp_) { 1026 if (it.frame()->fp() == thread_local_.last_fp_) {
994 if (step_count > 1) { 1027 if (step_count > 1) {
995 // Save old count and action to continue stepping after 1028 // Save old count and action to continue stepping after
996 // StepOut 1029 // StepOut
997 thread_local_.queued_step_count_ = step_count - 1; 1030 thread_local_.queued_step_count_ = step_count - 1;
998 } 1031 }
999 1032
1000 // Set up for StepOut to reach target frame 1033 // Set up for StepOut to reach target frame
1001 step_action = StepOut; 1034 step_action = StepOut;
(...skipping 2587 matching lines...) Expand 10 before | Expand all | Expand 10 after
3589 { 3622 {
3590 Locker locker; 3623 Locker locker;
3591 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3624 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3592 } 3625 }
3593 } 3626 }
3594 } 3627 }
3595 3628
3596 #endif // ENABLE_DEBUGGER_SUPPORT 3629 #endif // ENABLE_DEBUGGER_SUPPORT
3597 3630
3598 } } // namespace v8::internal 3631 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/debug.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698