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

Unified Diff: runtime/vm/profiler.cc

Issue 2976063002: Add top-level exception handler on Windows to dump stack traces (Closed)
Patch Set: Added more comments and restoring of console 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/platform_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler.cc
diff --git a/runtime/vm/profiler.cc b/runtime/vm/profiler.cc
index 840f438359bb62e7f0aca86a650467282959d987..7aa898217397e52f994212fbfc1426e339d06cf8 100644
--- a/runtime/vm/profiler.cc
+++ b/runtime/vm/profiler.cc
@@ -1076,6 +1076,20 @@ void Profiler::DumpStackTrace(void* context) {
uword fp = SignalHandler::GetFramePointer(mcontext);
uword sp = SignalHandler::GetCStackPointer(mcontext);
DumpStackTrace(sp, fp, pc, true /* for_crash */);
+#elif defined(HOST_OS_WINDOWS)
+ CONTEXT* ctx = reinterpret_cast<CONTEXT*>(context);
+#if defined(HOST_ARCH_IA32)
+ uword pc = static_cast<uword>(ctx->Eip);
+ uword fp = static_cast<uword>(ctx->Ebp);
+ uword sp = static_cast<uword>(ctx->Esp);
+#elif defined(HOST_ARCH_X64)
+ uword pc = static_cast<uword>(ctx->Rip);
+ uword fp = static_cast<uword>(ctx->Rbp);
+ uword sp = static_cast<uword>(ctx->Rsp);
+#else
+#error Unsupported architecture.
+#endif
+ DumpStackTrace(sp, fp, pc, true /* for_crash */);
#else
// TODO(fschneider): Add support for more platforms.
// Do nothing on unsupported platforms.
« no previous file with comments | « runtime/bin/platform_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698