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

Side by Side Diff: src/debug.cc

Issue 10698048: Put even more debug information on stack when aborting. (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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 895 void Debug::PutValuesOnStackAndDie(int start,
896 Address c_entry_fp, 896 Address c_entry_fp,
897 Address last_fp, 897 Address last_fp,
898 Address larger_fp, 898 Address larger_fp,
899 Address last_in_fp,
900 Address last_out_fp,
901 int count, 899 int count,
900 char* stack,
902 int end) { 901 int end) {
903 OS::PrintError("start: %d\n", start); 902 OS::PrintError("start: %d\n", start);
904 OS::PrintError("c_entry_fp: %p\n", static_cast<void*>(c_entry_fp)); 903 OS::PrintError("c_entry_fp: %p\n", static_cast<void*>(c_entry_fp));
905 OS::PrintError("last_fp: %p\n", static_cast<void*>(last_fp)); 904 OS::PrintError("last_fp: %p\n", static_cast<void*>(last_fp));
906 OS::PrintError("larger_fp: %p\n", static_cast<void*>(larger_fp)); 905 OS::PrintError("larger_fp: %p\n", static_cast<void*>(larger_fp));
907 OS::PrintError("last_in_fp: %p\n", static_cast<void*>(last_in_fp));
908 OS::PrintError("last_out_fp: %p\n", static_cast<void*>(last_out_fp));
909 OS::PrintError("count: %d\n", count); 906 OS::PrintError("count: %d\n", count);
907 if (stack != NULL) {
908 OS::PrintError("stack: %s\n", stack);
909 }
910 OS::PrintError("end: %d\n", end); 910 OS::PrintError("end: %d\n", end);
911 OS::Abort(); 911 OS::Abort();
912 } 912 }
913 913
914 914
915 Object* Debug::Break(Arguments args) { 915 Object* Debug::Break(Arguments args) {
916 Heap* heap = isolate_->heap(); 916 Heap* heap = isolate_->heap();
917 HandleScope scope(isolate_); 917 HandleScope scope(isolate_);
918 ASSERT(args.length() == 0); 918 ASSERT(args.length() == 0);
919 919
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) { 1007 while (!it.done() && it.frame()->fp() < thread_local_.last_fp_) {
1008 count++; 1008 count++;
1009 it.Advance(); 1009 it.Advance();
1010 } 1010 }
1011 1011
1012 // Catch the cases that would lead to crashes and capture 1012 // Catch the cases that would lead to crashes and capture
1013 // - C entry FP at which to start stack crawl. 1013 // - C entry FP at which to start stack crawl.
1014 // - FP of the frame at which we plan to stop stepping out (last FP). 1014 // - FP of the frame at which we plan to stop stepping out (last FP).
1015 // - current FP that's larger than last FP. 1015 // - current FP that's larger than last FP.
1016 // - Counter for the number of steps to step out. 1016 // - Counter for the number of steps to step out.
1017 // - stack trace string.
1017 if (it.done()) { 1018 if (it.done()) {
1018 // We crawled the entire stack, never reaching last_fp_. 1019 // We crawled the entire stack, never reaching last_fp_.
1019 PutValuesOnStackAndDie(0xBEEEEEEE, 1020 PutValuesOnStackAndDie(0xBEEEEEEE,
1020 frame->fp(), 1021 frame->fp(),
1021 thread_local_.last_fp_, 1022 thread_local_.last_fp_,
1023 reinterpret_cast<Address>(0xDEADDEAD),
1024 count,
1022 NULL, 1025 NULL,
1023 thread_local_.step_into_fp_, 1026 0xCEEEEEEE);
1024 thread_local_.step_out_fp_,
1025 count,
1026 0xFEEEEEEE);
1027 } else if (it.frame()->fp() != thread_local_.last_fp_) { 1027 } else if (it.frame()->fp() != thread_local_.last_fp_) {
1028 // We crawled over last_fp_, without getting a match. 1028 // We crawled over last_fp_, without getting a match.
1029 PutValuesOnStackAndDie(0xBEEEEEEE, 1029 Handle<String> stack = isolate_->StackTraceString();
1030 char buffer[2048];
1031 String::WriteToFlat(*stack, buffer, 0, 2047);
1032 PutValuesOnStackAndDie(0xDEEEEEEE,
1030 frame->fp(), 1033 frame->fp(),
1031 thread_local_.last_fp_, 1034 thread_local_.last_fp_,
1032 it.frame()->fp(), 1035 it.frame()->fp(),
1033 thread_local_.step_into_fp_,
1034 thread_local_.step_out_fp_,
1035 count, 1036 count,
1037 buffer,
1036 0xFEEEEEEE); 1038 0xFEEEEEEE);
1037 } 1039 }
1038 1040
1039 // If we found original frame 1041 // If we found original frame
1040 if (it.frame()->fp() == thread_local_.last_fp_) { 1042 if (it.frame()->fp() == thread_local_.last_fp_) {
1041 if (step_count > 1) { 1043 if (step_count > 1) {
1042 // Save old count and action to continue stepping after 1044 // Save old count and action to continue stepping after
1043 // StepOut 1045 // StepOut
1044 thread_local_.queued_step_count_ = step_count - 1; 1046 thread_local_.queued_step_count_ = step_count - 1;
1045 } 1047 }
(...skipping 2656 matching lines...) Expand 10 before | Expand all | Expand 10 after
3702 { 3704 {
3703 Locker locker; 3705 Locker locker;
3704 Isolate::Current()->debugger()->CallMessageDispatchHandler(); 3706 Isolate::Current()->debugger()->CallMessageDispatchHandler();
3705 } 3707 }
3706 } 3708 }
3707 } 3709 }
3708 3710
3709 #endif // ENABLE_DEBUGGER_SUPPORT 3711 #endif // ENABLE_DEBUGGER_SUPPORT
3710 3712
3711 } } // namespace v8::internal 3713 } } // 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