1
0
Fork 0

DBG: removed buggy cache

This commit is contained in:
mrexodia 2016-11-18 08:26:49 +01:00
parent f8ee9aa6df
commit 58bf10ab41
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 15 additions and 5 deletions

View File

@ -35,8 +35,6 @@
#include "TraceRecord.h"
static bool bOnlyCipAutoComments = false;
static duint cacheCflags = 0;
static duint cacheCcx = 0;
extern "C" DLL_EXPORT duint _dbg_memfindbaseaddr(duint addr, duint* size)
{
@ -98,7 +96,20 @@ extern "C" DLL_EXPORT bool _dbg_isjumpgoingtoexecute(duint addr)
{
Capstone cp;
if(cp.Disassemble(addr, data))
return cp.IsBranchGoingToExecute(cacheCflags, cacheCcx);
{
CONTEXT ctx;
memset(&ctx, 0, sizeof(ctx));
ctx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
GetThreadContext(hActiveThread, &ctx);
#ifdef _WIN64
auto cflags = ctx.RFlags;
auto ccx = ctx.Rcx;
#else
auto cflags = ctx.EFlags;
auto ccx = ctx.Ecx;
#endif //_WIN64
return cp.IsBranchGoingToExecute(cflags, ccx);
}
}
return false;
}
@ -550,8 +561,7 @@ extern "C" DLL_EXPORT bool _dbg_getregdump(REGDUMP* regdump)
return false;
TranslateTitanContextToRegContext(&titcontext, &regdump->regcontext);
duint cflags = cacheCflags = regdump->regcontext.eflags;
cacheCcx = regdump->regcontext.ccx;
duint cflags = regdump->regcontext.eflags;
regdump->flags.c = (cflags & (1 << 0)) != 0;
regdump->flags.p = (cflags & (1 << 2)) != 0;
regdump->flags.a = (cflags & (1 << 4)) != 0;