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

Side by Side Diff: src/debug.cc

Issue 10698116: Put additional information onto the stack when crashing in Debug::Break. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 5 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 // TODO(131642): Remove this when fixed.
895 void Debug::PutValuesOnStackAndDie(int start, 896 void Debug::PutValuesOnStackAndDie(int start,
896 Address c_entry_fp, 897 Address c_entry_fp,
897 Address last_fp, 898 Address last_fp,
898 Address larger_fp, 899 Address larger_fp,
899 int count, 900 int count,
900 char* stack, 901 char* stack,
901 int end) { 902 int end) {
902 OS::PrintError("start: %d\n", start); 903 OS::PrintError("start: %d\n", start);
903 OS::PrintError("c_entry_fp: %p\n", static_cast<void*>(c_entry_fp)); 904 OS::PrintError("c_entry_fp: %p\n", static_cast<void*>(c_entry_fp));
904 OS::PrintError("last_fp: %p\n", static_cast<void*>(last_fp)); 905 OS::PrintError("last_fp: %p\n", static_cast<void*>(last_fp));
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
1002 // and keep step count queued up in the meantime. 1003 // and keep step count queued up in the meantime.
1003 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) { 1004 if (step_action == StepNext && frame->fp() < thread_local_.last_fp_) {
1004 // Count frames until target frame 1005 // Count frames until target frame
1005 int count = 0; 1006 int count = 0;
1006 JavaScriptFrameIterator it(isolate_); 1007 JavaScriptFrameIterator it(isolate_);
1007 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) { 1008 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) {
1008 count++; 1009 count++;
1009 it.Advance(); 1010 it.Advance();
1010 } 1011 }
1011 1012
1013 // TODO(131642): Remove this when fixed.
1012 // Catch the cases that would lead to crashes and capture 1014 // Catch the cases that would lead to crashes and capture
1013 // - C entry FP at which to start stack crawl. 1015 // - C entry FP at which to start stack crawl.
1014 // - FP of the frame at which we plan to stop stepping out (last FP). 1016 // - FP of the frame at which we plan to stop stepping out (last FP).
1015 // - current FP that's larger than last FP. 1017 // - current FP that's larger than last FP.
1016 // - Counter for the number of steps to step out. 1018 // - Counter for the number of steps to step out.
1017 // - stack trace string. 1019 // - stack trace string.
1018 if (it.done()) { 1020 if (it.done()) {
1019 // We crawled the entire stack, never reaching last_fp_. 1021 // We crawled the entire stack, never reaching last_fp_.
1022 Handle<String> stack = isolate_->StackTraceString();
1023 char buffer[8192];
1024 int length = Min(8192, stack->length());
1025 String::WriteToFlat(*stack, buffer, 0, length - 1);
1020 PutValuesOnStackAndDie(0xBEEEEEEE, 1026 PutValuesOnStackAndDie(0xBEEEEEEE,
1021 frame->fp(), 1027 frame->fp(),
1022 thread_local_.last_fp_, 1028 thread_local_.last_fp_,
1023 reinterpret_cast<Address>(0xDEADDEAD), 1029 reinterpret_cast<Address>(0xDEADDEAD),
1024 count, 1030 count,
1025 NULL, 1031 buffer,
1026 0xCEEEEEEE); 1032 0xCEEEEEEE);
1027 } else if (it.frame()->fp() != thread_local_.last_fp_) { 1033 } else if (it.frame()->fp() != thread_local_.last_fp_) {
1028 // We crawled over last_fp_, without getting a match. 1034 // We crawled over last_fp_, without getting a match.
1029 Handle<String> stack = isolate_->StackTraceString(); 1035 Handle<String> stack = isolate_->StackTraceString();
1030 char buffer[8192]; 1036 char buffer[8192];
1031 String::WriteToFlat(*stack, buffer, 0, 8191); 1037 int length = Min(8192, stack->length());
1038 String::WriteToFlat(*stack, buffer, 0, length - 1);
1032 PutValuesOnStackAndDie(0xDEEEEEEE, 1039 PutValuesOnStackAndDie(0xDEEEEEEE,
1033 frame->fp(), 1040 frame->fp(),
1034 thread_local_.last_fp_, 1041 thread_local_.last_fp_,
1035 it.frame()->fp(), 1042 it.frame()->fp(),
1036 count, 1043 count,
1037 buffer, 1044 buffer,
1038 0xFEEEEEEE); 1045 0xFEEEEEEE);
1039 } 1046 }
1040 1047
1041 // If we found original frame 1048 // If we found original frame
(...skipping 2662 matching lines...) Expand 10 before | Expand all | Expand 10 after
3704 { 3711 {
3705 Locker locker; 3712 Locker locker;
3706 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3713 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3707 } 3714 }
3708 } 3715 }
3709 } 3716 }
3710 3717
3711 #endif // ENABLE_DEBUGGER_SUPPORT 3718 #endif // ENABLE_DEBUGGER_SUPPORT
3712 3719
3713 } } // namespace v8::internal 3720 } } // 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