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

Unified Diff: runtime/vm/profiler.cc

Issue 2813283002: Add --print_stacktrace_at_api_error. (Closed)
Patch Set: . Created 3 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index c41f051ef4b20c68e5bc78617928f70e3694237f..8bfd7299fe6575e1bdc291ee1df6a536b7d74fd9 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -875,9 +875,9 @@ static bool GetAndValidateThreadStackBounds(Thread* thread,
#endif
if (!use_simulator_stack_bounds &&
- !os_thread->GetProfilerStackBounds(stack_lower, stack_upper) &&
!(get_os_thread_bounds &&
- OSThread::GetCurrentStackBounds(stack_lower, stack_upper))) {
+ OSThread::GetCurrentStackBounds(stack_lower, stack_upper)) &&
+ !os_thread->GetProfilerStackBounds(stack_lower, stack_upper)) {
// Could not get stack boundary.
return false;
}
@@ -969,7 +969,7 @@ void Profiler::DumpStackTrace(void* context) {
uword pc = SignalHandler::GetProgramCounter(mcontext);
uword fp = SignalHandler::GetFramePointer(mcontext);
uword sp = SignalHandler::GetCStackPointer(mcontext);
- DumpStackTrace(sp, fp, pc);
+ DumpStackTrace(sp, fp, pc, true /* for_crash */);
#else
// TODO(fschneider): Add support for more platforms.
// Do nothing on unsupported platforms.
@@ -977,24 +977,26 @@ void Profiler::DumpStackTrace(void* context) {
}
-void Profiler::DumpStackTrace() {
+void Profiler::DumpStackTrace(bool for_crash) {
uintptr_t sp = Thread::GetCurrentStackPointer();
uintptr_t fp = 0;
uintptr_t pc = OS::GetProgramCounter();
COPY_FP_REGISTER(fp);
- DumpStackTrace(sp, fp, pc);
+ DumpStackTrace(sp, fp, pc, for_crash);
}
-void Profiler::DumpStackTrace(uword sp, uword fp, uword pc) {
- // Allow only one stack trace to prevent recursively printing stack traces if
- // we hit an assert while printing the stack.
- static uintptr_t started_dump = 0;
- if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) {
- OS::PrintErr("Aborting re-entrant request for stack trace.\n");
- return;
+void Profiler::DumpStackTrace(uword sp, uword fp, uword pc, bool for_crash) {
+ if (for_crash) {
+ // Allow only one stack trace to prevent recursively printing stack traces
+ // if we hit an assert while printing the stack.
+ static uintptr_t started_dump = 0;
+ if (AtomicOperations::FetchAndIncrement(&started_dump) != 0) {
+ OS::PrintErr("Aborting re-entrant request for stack trace.\n");
+ return;
+ }
}
siva 2017/04/13 01:50:18 Why is this logic relevant only when for_crash is
Thread* thread = Thread::Current();
« no previous file with comments | « runtime/vm/profiler.h ('k') | runtime/vm/thread_pool.cc » ('j') | runtime/vm/thread_pool.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698