mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
feat: Improved exception handling (#969)
This commit is contained in:
parent
e1dd616733
commit
37a10a7181
@ -22,13 +22,17 @@ namespace big
|
||||
exception_code == DBG_PRINTEXCEPTION_WIDE_C)
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
|
||||
LOG(FATAL) << stack_trace(exception_info);
|
||||
stack_trace stack_trace(exception_info);
|
||||
LOG(FATAL) << stack_trace;
|
||||
|
||||
ZyanU64 opcode_address = exception_info->ContextRecord->Rip;
|
||||
ZydisDisassembledInstruction instruction;
|
||||
ZydisDisassembleIntel(ZYDIS_MACHINE_MODE_LONG_64, opcode_address, reinterpret_cast<void*>(opcode_address), 32, &instruction);
|
||||
|
||||
exception_info->ContextRecord->Rip += instruction.info.length;
|
||||
if(stack_trace.m_ret_context.Rip)
|
||||
*exception_info->ContextRecord = stack_trace.m_ret_context;
|
||||
else
|
||||
exception_info->ContextRecord->Rip += instruction.info.length;
|
||||
|
||||
return EXCEPTION_CONTINUE_EXECUTION;
|
||||
}
|
||||
|
@ -172,6 +172,9 @@ namespace big
|
||||
break;
|
||||
}
|
||||
m_frame_pointers[i] = frame.AddrPC.Offset;
|
||||
|
||||
if (i == 1)
|
||||
m_ret_context = context;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,12 @@ namespace big
|
||||
stack_trace(EXCEPTION_POINTERS* exception_info);
|
||||
virtual ~stack_trace();
|
||||
|
||||
CONTEXT m_ret_context{};
|
||||
|
||||
std::string str() const;
|
||||
|
||||
friend std::ostream& operator<< (std::ostream& os, const stack_trace& st);
|
||||
friend std::ostream& operator<< (std::ostream& os, const stack_trace* st);
|
||||
|
||||
private:
|
||||
struct module_info
|
||||
@ -57,4 +60,11 @@ namespace big
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
inline std::ostream& operator<< (std::ostream& os, const stack_trace* st)
|
||||
{
|
||||
os << st->str();
|
||||
|
||||
return os;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user