| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "CrashHandler.h" | 8 #include "CrashHandler.h" |
| 9 | 9 |
| 10 #include "SkTypes.h" | 10 #include "SkTypes.h" |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 frame.AddrStack.Offset = c->Rsp; | 143 frame.AddrStack.Offset = c->Rsp; |
| 144 frame.AddrFrame.Offset = c->Rbp; | 144 frame.AddrFrame.Offset = c->Rbp; |
| 145 const DWORD machineType = IMAGE_FILE_MACHINE_AMD64; | 145 const DWORD machineType = IMAGE_FILE_MACHINE_AMD64; |
| 146 #endif | 146 #endif |
| 147 | 147 |
| 148 while (StackWalk64(machineType, | 148 while (StackWalk64(machineType, |
| 149 GetCurrentProcess(), | 149 GetCurrentProcess(), |
| 150 GetCurrentThread(), | 150 GetCurrentThread(), |
| 151 &frame, | 151 &frame, |
| 152 c, | 152 c, |
| 153 NULL, | 153 nullptr, |
| 154 SymFunctionTableAccess64, | 154 SymFunctionTableAccess64, |
| 155 SymGetModuleBase64, | 155 SymGetModuleBase64, |
| 156 NULL)) { | 156 nullptr)) { |
| 157 // Buffer to store symbol name in. | 157 // Buffer to store symbol name in. |
| 158 static const int kMaxNameLength = 1024; | 158 static const int kMaxNameLength = 1024; |
| 159 uint8_t buffer[sizeof(IMAGEHLP_SYMBOL64) + kMaxNameLength]; | 159 uint8_t buffer[sizeof(IMAGEHLP_SYMBOL64) + kMaxNameLength]; |
| 160 sk_bzero(buffer, sizeof(buffer)); | 160 sk_bzero(buffer, sizeof(buffer)); |
| 161 | 161 |
| 162 // We have to place IMAGEHLP_SYMBOL64 at the front, and fill in | 162 // We have to place IMAGEHLP_SYMBOL64 at the front, and fill in |
| 163 // how much space it can use. | 163 // how much space it can use. |
| 164 IMAGEHLP_SYMBOL64* symbol = reinterpret_cast<IMAGEHLP_SYMBOL64*>
(&buffer); | 164 IMAGEHLP_SYMBOL64* symbol = reinterpret_cast<IMAGEHLP_SYMBOL64*>
(&buffer); |
| 165 symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); | 165 symbol->SizeOfStruct = sizeof(IMAGEHLP_SYMBOL64); |
| 166 symbol->MaxNameLength = kMaxNameLength - 1; | 166 symbol->MaxNameLength = kMaxNameLength - 1; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 183 void SetupCrashHandler() { | 183 void SetupCrashHandler() { |
| 184 SetUnhandledExceptionFilter(handler); | 184 SetUnhandledExceptionFilter(handler); |
| 185 } | 185 } |
| 186 | 186 |
| 187 #else // We asked for SK_CRASH_HANDLER, but it's not Mac, Linux, or Windows
. Sorry! | 187 #else // We asked for SK_CRASH_HANDLER, but it's not Mac, Linux, or Windows
. Sorry! |
| 188 | 188 |
| 189 void SetupCrashHandler() { } | 189 void SetupCrashHandler() { } |
| 190 | 190 |
| 191 #endif | 191 #endif |
| 192 #endif // SK_CRASH_HANDLER | 192 #endif // SK_CRASH_HANDLER |
| OLD | NEW |