feat(debug): log msvc c++ exception properly. (#1790)

This commit is contained in:
Quentin 2023-07-21 16:00:01 +02:00 committed by GitHub
parent 3e5cad97e9
commit 5b1fd3e01c
2 changed files with 13 additions and 1 deletions

View File

@ -38,6 +38,7 @@ namespace big
dump_module_info();
dump_registers();
dump_stacktrace();
dump_cpp_exception();
m_dump << "\n--------End of exception--------\n";
}
@ -155,6 +156,16 @@ namespace big
<< m_exception_info->ContextRecord->Rdi - m_exception_info->ContextRecord->Rsi << '\n';
}
void stack_trace::dump_cpp_exception()
{
constexpr DWORD msvc_exception_code = 0xe06d7363;
if (m_exception_info->ExceptionRecord->ExceptionCode == msvc_exception_code)
{
m_dump
<< reinterpret_cast<const std::exception*>(m_exception_info->ExceptionRecord->ExceptionInformation[1])->what() << '\n';
}
}
void stack_trace::grab_stacktrace()
{
CONTEXT context = *m_exception_info->ContextRecord;
@ -200,6 +211,6 @@ namespace big
if (const auto& it = exceptions.find(code); it != exceptions.end())
return it->second;
return "UNKNOWN_EXCEPTION";
return "UNKNOWN_EXCEPTION: CODE: " + std::to_string(code);
}
}

View File

@ -39,6 +39,7 @@ namespace big
void dump_registers();
void dump_stacktrace();
void dump_script_info();
void dump_cpp_exception();
void grab_stacktrace();
const module_info* get_module_by_address(uint64_t addr) const;