1
0
Fork 0

DBG: added DbgFunctions()->DisasmFast

This commit is contained in:
Mr. eXoDia 2014-07-07 17:00:24 +02:00
parent baf40769ce
commit 47c0518f59
6 changed files with 14 additions and 1 deletions

View File

@ -469,6 +469,8 @@ struct BASIC_INSTRUCTION_INFO
ULONG_PTR addr; //addrvalue (jumps + calls)
bool branch; //jumps/calls
bool call; //instruction is a call
int size;
char instruction[MAX_MNEMONIC_SIZE*4];
};
struct SCRIPTBRANCH

View File

@ -5,6 +5,7 @@
#include "addrinfo.h"
#include "patches.h"
#include "memory.h"
#include "disasm_fast.h"
static DBGFUNCTIONS _dbgfunctions;
@ -117,4 +118,5 @@ void dbgfunctionsinit()
_dbgfunctions.PatchFile=(PATCHFILE)patchfile;
_dbgfunctions.ModPathFromAddr=_modpathfromaddr;
_dbgfunctions.ModPathFromName=_modpathfromname;
_dbgfunctions.DisasmFast=disasmfast;
}

View File

@ -25,6 +25,7 @@ typedef bool (*PATCHRESTORE)(duint addr);
typedef int (*PATCHFILE)(DBGPATCHINFO* patchlist, int count, const char* szFileName, char* error);
typedef int (*MODPATHFROMADDR)(duint addr, char* path, int size);
typedef int (*MODPATHFROMNAME)(const char* modname, char* path, int size);
typedef bool (*DISASMFAST)(unsigned char* data, duint addr, BASIC_INSTRUCTION_INFO* basicinfo);
struct DBGFUNCTIONS
{
@ -44,6 +45,7 @@ struct DBGFUNCTIONS
PATCHFILE PatchFile;
MODPATHFROMADDR ModPathFromAddr;
MODPATHFROMNAME ModPathFromName;
DISASMFAST DisasmFast;
};
#ifdef BUILD_DBG

View File

@ -869,8 +869,11 @@ extern "C" DLL_EXPORT uint _dbg_sendmessage(DBGMSG type, void* param1, void* par
#endif // _WIN64
disasm.EIP=(UIntPtr)data;
disasm.VirtualAddr=(UInt64)param1;
int len=Disasm(&disasm);
uint i=0;
fillbasicinfo(&disasm, (BASIC_INSTRUCTION_INFO*)param2);
BASIC_INSTRUCTION_INFO* basicinfo=(BASIC_INSTRUCTION_INFO*)param2;
basicinfo->size=len;
fillbasicinfo(&disasm, basicinfo);
}
break;

View File

@ -22,6 +22,8 @@ void fillbasicinfo(DISASM* disasm, BASIC_INSTRUCTION_INFO* basicinfo)
{
//zero basicinfo
memset(basicinfo, 0, sizeof(BASIC_INSTRUCTION_INFO));
//copy instruction text
strcpy(basicinfo->instruction, disasm->CompleteInstr);
//find immidiat
if(disasm->Instruction.BranchType==0) //no branch
{
@ -104,6 +106,7 @@ bool disasmfast(unsigned char* data, uint addr, BASIC_INSTRUCTION_INFO* basicinf
int len=Disasm(&disasm);
if(len==UNKNOWN_OPCODE)
return false;
basicinfo->size=len;
fillbasicinfo(&disasm, basicinfo);
return true;
}

View File

@ -62,6 +62,7 @@ int reffind(uint addr, uint size, CBREF cbRef, void* userinfo, bool silent)
int len=Disasm(&disasm);
if(len!=UNKNOWN_OPCODE)
{
basicinfo.size=len;
fillbasicinfo(&disasm, &basicinfo);
if(cbRef(&disasm, &basicinfo, &refinfo))
refinfo.refcount++;