Chromium Code Reviews| Index: runtime/bin/platform_win.cc |
| diff --git a/runtime/bin/platform_win.cc b/runtime/bin/platform_win.cc |
| index b0e8eabb1e78c9126fe2bcca2f76107c7c18a0f3..685a89be5e6711cd8fa2722befa7f14cd916b691 100644 |
| --- a/runtime/bin/platform_win.cc |
| +++ b/runtime/bin/platform_win.cc |
| @@ -36,6 +36,18 @@ extern bool private_flag_windows_run_tls_destructors; |
| namespace bin { |
| + |
| +static LONG WINAPI |
|
zra
2017/07/12 22:14:59
Could you add a comment here with a link to the do
alexmarkov
2017/07/12 22:39:49
Done.
|
| +DartExceptionHandler(struct _EXCEPTION_POINTERS* ExceptionInfo) { |
| + if (ExceptionInfo->ExceptionRecord->ExceptionCode == |
| + EXCEPTION_ACCESS_VIOLATION) { |
| + Dart_DumpNativeStackTrace(ExceptionInfo->ContextRecord); |
| + abort(); |
|
zra
2017/07/12 22:14:59
It would be polite of us to call PlatformWin::Rest
alexmarkov
2017/07/12 22:39:49
Done.
|
| + } |
| + return EXCEPTION_CONTINUE_SEARCH; |
| +} |
| + |
| + |
| const char* Platform::executable_name_ = NULL; |
| char* Platform::resolved_executable_name_ = NULL; |
| int Platform::script_index_ = 1; |
| @@ -62,6 +74,10 @@ class PlatformWin { |
| // CTRL_C_EVENT signal. This will only run when there is no signal handler |
| // registered for the CTRL_C_EVENT from Dart code. |
| SetConsoleCtrlHandler(SignalHandler, TRUE); |
| +#ifndef PRODUCT |
| + // Set up global exception handler to be able to dump stack trace on crash. |
| + SetExceptionHandler(); |
| +#endif |
| } |
| static BOOL WINAPI SignalHandler(DWORD signal) { |
| @@ -106,6 +122,10 @@ class PlatformWin { |
| RestoreConsoleLocked(); |
| } |
| + static void SetExceptionHandler() { |
| + SetUnhandledExceptionFilter(DartExceptionHandler); |
| + } |
| + |
| private: |
| static Mutex* platform_win_mutex_; |
| static int saved_output_cp_; |