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

Side by Side Diff: runtime/lib/stacktrace.cc

Issue 254683003: Fix stacktrace crasher bug in the VM and duplicate breakpoint crasher bug. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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/bootstrap_natives.h" 5 #include "vm/bootstrap_natives.h"
6 #include "vm/exceptions.h" 6 #include "vm/exceptions.h"
7 #include "vm/object_store.h" 7 #include "vm/object_store.h"
8 #include "vm/runtime_entry.h" 8 #include "vm/runtime_entry.h"
9 #include "vm/stack_frame.h" 9 #include "vm/stack_frame.h"
10 10
11 namespace dart { 11 namespace dart {
12 12
13 // Get a full stack trace. 13 // Get a full stack trace.
14 // Arg0: stack trace object. 14 // Arg0: stack trace object.
15 // Return value: String that represents the full stack trace. 15 // Return value: String that represents the full stack trace.
16 DEFINE_NATIVE_ENTRY(Stacktrace_getFullStacktrace, 1) { 16 DEFINE_NATIVE_ENTRY(Stacktrace_getFullStacktrace, 1) {
17 const Stacktrace& trace = 17 const Stacktrace& trace =
18 Stacktrace::CheckedHandle(arguments->NativeArgAt(0)); 18 Stacktrace::CheckedHandle(arguments->NativeArgAt(0));
19 return trace.FullStacktrace(); 19 return trace.FullStacktrace();
20 } 20 }
21 21
22 22
23 // Get a concise and pertinent stack trace. 23 // Get a concise and pertinent stack trace.
24 // Arg0: stack trace object. 24 // Arg0: stack trace object.
25 // Return value: String that represents the concise and pertinent stack trace. 25 // Return value: String that represents the concise and pertinent stack trace.
26 DEFINE_NATIVE_ENTRY(Stacktrace_getStacktrace, 1) { 26 DEFINE_NATIVE_ENTRY(Stacktrace_getStacktrace, 1) {
27 const Stacktrace& trace = 27 const Stacktrace& trace =
28 Stacktrace::CheckedHandle(arguments->NativeArgAt(0)); 28 Stacktrace::CheckedHandle(arguments->NativeArgAt(0));
29 return String::New(trace.ToCStringInternal(0)); 29 intptr_t frame_index = 0;
30 return String::New(trace.ToCStringInternal(&frame_index));
Jacob 2014/04/24 20:28:55 needed to avoid a null ptr exception.
30 } 31 }
31 32
32 33
33 static void IterateFrames(const GrowableObjectArray& code_list, 34 static void IterateFrames(const GrowableObjectArray& code_list,
34 const GrowableObjectArray& pc_offset_list) { 35 const GrowableObjectArray& pc_offset_list) {
35 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames); 36 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames);
36 StackFrame* frame = frames.NextFrame(); 37 StackFrame* frame = frames.NextFrame();
37 ASSERT(frame != NULL); // We expect to find a dart invocation frame. 38 ASSERT(frame != NULL); // We expect to find a dart invocation frame.
38 Code& code = Code::Handle(); 39 Code& code = Code::Handle();
39 Smi& offset = Smi::Handle(); 40 Smi& offset = Smi::Handle();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 IterateFrames(code_list, pc_offset_list); 91 IterateFrames(code_list, pc_offset_list);
91 const Array& code_array = Array::Handle(Array::MakeArray(code_list)); 92 const Array& code_array = Array::Handle(Array::MakeArray(code_list));
92 const Array& pc_offset_array = 93 const Array& pc_offset_array =
93 Array::Handle(Array::MakeArray(pc_offset_list)); 94 Array::Handle(Array::MakeArray(pc_offset_list));
94 const Stacktrace& stacktrace = Stacktrace::Handle( 95 const Stacktrace& stacktrace = Stacktrace::Handle(
95 Stacktrace::New(code_array, pc_offset_array)); 96 Stacktrace::New(code_array, pc_offset_array));
96 OS::Print("%s\n", stacktrace.ToCString()); 97 OS::Print("%s\n", stacktrace.ToCString());
97 } 98 }
98 99
99 } // namespace dart 100 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698