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

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

Issue 1448003002: Add StackTrace.current getter. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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
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
(...skipping 30 matching lines...) Expand all
41 GrowableObjectArray::Handle(GrowableObjectArray::New()); 41 GrowableObjectArray::Handle(GrowableObjectArray::New());
42 IterateFrames(code_list, pc_offset_list); 42 IterateFrames(code_list, pc_offset_list);
43 const Array& code_array = Array::Handle(Array::MakeArray(code_list)); 43 const Array& code_array = Array::Handle(Array::MakeArray(code_list));
44 const Array& pc_offset_array = 44 const Array& pc_offset_array =
45 Array::Handle(Array::MakeArray(pc_offset_list)); 45 Array::Handle(Array::MakeArray(pc_offset_list));
46 const Stacktrace& stacktrace = Stacktrace::Handle( 46 const Stacktrace& stacktrace = Stacktrace::Handle(
47 Stacktrace::New(code_array, pc_offset_array)); 47 Stacktrace::New(code_array, pc_offset_array));
48 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString()); 48 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
49 } 49 }
50 50
51 DEFINE_NATIVE_ENTRY(StackTrace_current, 0) {
52 const GrowableObjectArray& code_list =
53 GrowableObjectArray::Handle(GrowableObjectArray::New());
54 const GrowableObjectArray& pc_offset_list =
55 GrowableObjectArray::Handle(GrowableObjectArray::New());
56 // Skip the StackFrame.current frame.
57 IterateFrames(code_list, pc_offset_list);
58 const Array& code_array = Array::Handle(Array::MakeArray(code_list));
59 const Array& pc_offset_array =
60 Array::Handle(Array::MakeArray(pc_offset_list));
61 const Stacktrace& stacktrace = Stacktrace::Handle(
62 Stacktrace::New(code_array, pc_offset_array));
63 return stacktrace.raw();
64 }
Lasse Reichstein Nielsen 2015/11/18 10:11:38 The VM even has the option of dropping the first s
65
66
51 } // namespace dart 67 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698