Always enable proper symbolize implementation on Windows (#257)

This commit is contained in:
Loo Rong Jie 2019-10-22 08:34:46 +08:00 committed by Derek Mauro
parent 2796d500ae
commit ecc0033b54
5 changed files with 45 additions and 17 deletions

View file

@ -57,9 +57,8 @@ bool Symbolize(const void *pc, char *out, int out_size) {
if (out_size <= 0) {
return false;
}
std::aligned_storage<sizeof(SYMBOL_INFO) + MAX_SYM_NAME,
alignof(SYMBOL_INFO)>::type buf;
SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(&buf);
alignas(SYMBOL_INFO) char buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
SYMBOL_INFO *symbol = reinterpret_cast<SYMBOL_INFO *>(buf);
symbol->SizeOfStruct = sizeof(SYMBOL_INFO);
symbol->MaxNameLen = MAX_SYM_NAME;
if (!SymFromAddr(process, reinterpret_cast<DWORD64>(pc), nullptr, symbol)) {