Introduced GetDetectedSymbolName
This shows a name+offset next to an exception address
This commit is contained in:
parent
3f7f94f2a5
commit
b855b69c6f
|
@ -187,13 +187,16 @@ void EmuExceptionNonBreakpointUnhandledShow(LPEXCEPTION_POINTERS e)
|
|||
{
|
||||
EmuExceptionPrintDebugInformation(e, /*IsBreakpointException=*/false);
|
||||
|
||||
int symbolOffset = 0;
|
||||
std::string symbolName = GetDetectedSymbolName(e->ContextRecord->Eip, &symbolOffset);
|
||||
|
||||
char buffer[256];
|
||||
sprintf(buffer,
|
||||
"Recieved Exception Code 0x%.08X @ EIP := 0x%.08X\n"
|
||||
"Recieved Exception Code 0x%.08X @ EIP := 0x%.08X (= %s+0x%x)\n"
|
||||
"\n"
|
||||
" Press \"OK\" to terminate emulation.\n"
|
||||
" Press \"Cancel\" to debug.",
|
||||
e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip);
|
||||
e->ExceptionRecord->ExceptionCode, e->ContextRecord->Eip, symbolName.c_str(), symbolOffset);
|
||||
|
||||
if (MessageBox(g_hEmuWindow, buffer, "Cxbx-Reloaded", MB_ICONSTOP | MB_OKCANCEL) == IDOK)
|
||||
{
|
||||
|
|
|
@ -54,7 +54,7 @@ static inline void EmuInstallPatch(xbaddr FunctionAddr, void *Patch);
|
|||
#include <unordered_map>
|
||||
#include <sstream>
|
||||
|
||||
std::unordered_map<std::string, uint32_t> g_HLECache;
|
||||
std::unordered_map<std::string, xbaddr> g_HLECache;
|
||||
bool g_HLECacheUsed = false;
|
||||
|
||||
uint32 g_BuildVersion;
|
||||
|
@ -66,6 +66,30 @@ bool bLLE_JIT = false; // Set this to true for experimental JIT
|
|||
bool bXRefFirstPass; // For search speed optimization, set in EmuHLEIntercept, read in EmuLocateFunction
|
||||
uint32 UnResolvedXRefs; // Tracks XRef location, used (read/write) in EmuHLEIntercept and EmuLocateFunction
|
||||
|
||||
std::string GetDetectedSymbolName(xbaddr address, int *symbolOffset)
|
||||
{
|
||||
std::string result = "";
|
||||
int closestMatch = MAXINT;
|
||||
|
||||
for (auto it = g_HLECache.begin(); it != g_HLECache.end(); ++it) {
|
||||
xbaddr symbolAddr = (*it).second;
|
||||
int distance = symbolAddr - address;
|
||||
if (distance >= 0)
|
||||
{
|
||||
if (closestMatch > distance)
|
||||
{
|
||||
std::string symbolName = (*it).first;
|
||||
|
||||
closestMatch = distance;
|
||||
result = symbolName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*symbolOffset = closestMatch;
|
||||
return result;
|
||||
}
|
||||
|
||||
void EmuHLEIntercept(Xbe::Header *pXbeHeader)
|
||||
{
|
||||
Xbe::Certificate *pCertificate = (Xbe::Certificate*)pXbeHeader->dwCertificateAddr;
|
||||
|
|
|
@ -40,6 +40,8 @@ extern bool bLLE_JIT; // Set this to true for experimental JIT
|
|||
|
||||
void EmuHLEIntercept(Xbe::Header *XbeHeader);
|
||||
|
||||
std::string GetDetectedSymbolName(xbaddr address, int *symbolOffset);
|
||||
|
||||
#ifdef _DEBUG_TRACE
|
||||
void VerifyHLEDataBase();
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue