OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 21061 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21072 Zone* zone = Thread::Current()->zone(); | 21072 Zone* zone = Thread::Current()->zone(); |
21073 Function& function = Function::Handle(); | 21073 Function& function = Function::Handle(); |
21074 Code& code = Code::Handle(); | 21074 Code& code = Code::Handle(); |
21075 // Iterate through the stack frames and create C string description | 21075 // Iterate through the stack frames and create C string description |
21076 // for each frame. | 21076 // for each frame. |
21077 intptr_t total_len = 0; | 21077 intptr_t total_len = 0; |
21078 GrowableArray<char*> frame_strings; | 21078 GrowableArray<char*> frame_strings; |
21079 for (intptr_t i = 0; (i < Length()) && (*frame_index < max_frames); i++) { | 21079 for (intptr_t i = 0; (i < Length()) && (*frame_index < max_frames); i++) { |
21080 function = FunctionAtFrame(i); | 21080 function = FunctionAtFrame(i); |
21081 if (function.IsNull()) { | 21081 if (function.IsNull()) { |
21082 // Check if null function object indicates a gap in a StackOverflow or | 21082 // Check for a null function, which indicates a gap in a StackOverflow or |
21083 // OutOfMemory trace. | 21083 // OutOfMemory trace. |
21084 if ((i < (Length() - 1)) && | 21084 if ((i < (Length() - 1)) && |
21085 (FunctionAtFrame(i + 1) != Function::null())) { | 21085 (FunctionAtFrame(i + 1) != Function::null())) { |
21086 const char* kTruncated = "...\n...\n"; | 21086 const char* kTruncated = "...\n...\n"; |
21087 intptr_t truncated_len = strlen(kTruncated) + 1; | 21087 intptr_t truncated_len = strlen(kTruncated) + 1; |
21088 char* chars = zone->Alloc<char>(truncated_len); | 21088 char* chars = zone->Alloc<char>(truncated_len); |
21089 OS::SNPrint(chars, truncated_len, "%s", kTruncated); | 21089 OS::SNPrint(chars, truncated_len, "%s", kTruncated); |
21090 frame_strings.Add(chars); | 21090 frame_strings.Add(chars); |
21091 total_len += truncated_len; | 21091 total_len += truncated_len; |
| 21092 ASSERT(PcOffsetAtFrame(i) != Smi::null()); |
| 21093 // To account for gap frames. |
| 21094 (*frame_index) += Smi::Value(PcOffsetAtFrame(i)); |
21092 } | 21095 } |
21093 } else { | 21096 } else { |
21094 code = CodeAtFrame(i); | 21097 code = CodeAtFrame(i); |
21095 ASSERT(function.raw() == code.function()); | 21098 ASSERT(function.raw() == code.function()); |
21096 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); | 21099 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); |
21097 if (code.is_optimized() && expand_inlined()) { | 21100 if (code.is_optimized() && expand_inlined()) { |
21098 // Traverse inlined frames. | 21101 // Traverse inlined frames. |
21099 if (!FLAG_precompilation) { | 21102 if (!FLAG_precompilation) { |
21100 for (InlinedFunctionsIterator it(code, pc); | 21103 for (InlinedFunctionsIterator it(code, pc); |
21101 !it.Done() && (*frame_index < max_frames); it.Advance()) { | 21104 !it.Done() && (*frame_index < max_frames); it.Advance()) { |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21462 return UserTag::null(); | 21465 return UserTag::null(); |
21463 } | 21466 } |
21464 | 21467 |
21465 | 21468 |
21466 const char* UserTag::ToCString() const { | 21469 const char* UserTag::ToCString() const { |
21467 const String& tag_label = String::Handle(label()); | 21470 const String& tag_label = String::Handle(label()); |
21468 return tag_label.ToCString(); | 21471 return tag_label.ToCString(); |
21469 } | 21472 } |
21470 | 21473 |
21471 } // namespace dart | 21474 } // namespace dart |
OLD | NEW |