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

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

Issue 2957843002: Add gdb helper functions for creating a handle and using ToCString with RawObjects. (Closed)
Patch Set: Created 3 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
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 "lib/stacktrace.h" 5 #include "lib/stacktrace.h"
6 #include "vm/bootstrap_natives.h" 6 #include "vm/bootstrap_natives.h"
7 #include "vm/debugger.h" 7 #include "vm/debugger.h"
8 #include "vm/exceptions.h" 8 #include "vm/exceptions.h"
9 #include "vm/native_entry.h" 9 #include "vm/native_entry.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 GrowableObjectArray::Handle(GrowableObjectArray::New()); 174 GrowableObjectArray::Handle(GrowableObjectArray::New());
175 AppendFrames(code_list, pc_offset_list, skip_frames); 175 AppendFrames(code_list, pc_offset_list, skip_frames);
176 const Array& code_array = Array::Handle(Array::MakeFixedLength(code_list)); 176 const Array& code_array = Array::Handle(Array::MakeFixedLength(code_list));
177 const Array& pc_offset_array = 177 const Array& pc_offset_array =
178 Array::Handle(Array::MakeFixedLength(pc_offset_list)); 178 Array::Handle(Array::MakeFixedLength(pc_offset_list));
179 const StackTrace& stacktrace = 179 const StackTrace& stacktrace =
180 StackTrace::Handle(StackTrace::New(code_array, pc_offset_array)); 180 StackTrace::Handle(StackTrace::New(code_array, pc_offset_array));
181 return stacktrace; 181 return stacktrace;
182 } 182 }
183 183
184
185 // An utility method for convenient printing of dart stack traces when
186 // inside 'gdb'. Note: This function will only work when there is a
187 // valid exit frame information. It will not work when a breakpoint is
188 // set in dart code and control is got inside 'gdb' without going through
189 // the runtime or native transition stub.
190 void _printCurrentStackTrace() {
191 const StackTrace& stacktrace = GetCurrentStackTrace(0);
192 OS::PrintErr("=== Current Trace:\n%s===\n", stacktrace.ToCString());
193 }
194
195
196 // Like _printCurrentStackTrace, but works in a NoSafepointScope.
197 void _printCurrentStackTraceNoSafepoint() {
198 StackFrameIterator frames(StackFrameIterator::kDontValidateFrames,
199 Thread::Current(),
200 StackFrameIterator::kNoCrossThreadIteration);
201 StackFrame* frame = frames.NextFrame();
202 while (frame != NULL) {
203 OS::PrintErr("%s\n", frame->ToCString());
204 frame = frames.NextFrame();
205 }
206 }
207
208 } // namespace dart 184 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/lib/object.cc ('k') | runtime/vm/gdb_helpers.cc » ('j') | runtime/vm/gdb_helpers.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698