initial work on memory breakpoints

This commit is contained in:
mrexodia 2016-08-05 14:48:48 +02:00
parent 688fe89439
commit 3d385178da
4 changed files with 16 additions and 5 deletions

View File

@ -49,6 +49,14 @@ namespace GleeBug
Execute
};
struct MemoryBreakpointInfo
{
struct
{
uint32 offset;
} info[PAGE_SIZE];
};
/**
\brief Structure describing internal breakpoint info.
*/
@ -73,6 +81,7 @@ namespace GleeBug
{
MemoryType type;
ptr size;
MemoryBreakpointInfo* info;
} memory;
};
};

View File

@ -5,6 +5,7 @@
//defines
#define GLEEBUG_HWBP_COUNT 4
#define GLEEBUG_PAGE_SIZE 0x1000
namespace GleeBug
{
@ -18,6 +19,7 @@ namespace GleeBug
//constants
const int HWBP_COUNT = GLEEBUG_HWBP_COUNT;
const int PAGE_SIZE = GLEEBUG_PAGE_SIZE;
//key typedefs
typedef std::pair<BreakpointType, ptr> BreakpointKey;

View File

@ -12,7 +12,7 @@ protected:
{
printf("Reached entry breakpoint! GIP: 0x%p\n",
mRegisters->Gip());
if (mProcess->DeleteBreakpoint(info.address))
/*if (mProcess->DeleteBreakpoint(info.address))
printf("Entry breakpoint deleted!\n");
else
printf("Failed to delete entry breakpoint...\n");
@ -20,7 +20,7 @@ protected:
{
printf("Step after entry breakpoint! GIP: 0x%p\n",
mRegisters->Gip());
});
});*/
}
void cbEntryHardwareBreakpoint(const BreakpointInfo & info)
@ -61,7 +61,7 @@ protected:
else
printf("No free hardware breakpoint slot...\n");*/
if(mProcess->SetBreakpoint(entry, this, &MyDebugger::cbEntryBreakpoint))
if(mProcess->SetBreakpoint(entry, this, &MyDebugger::cbEntryBreakpoint, true))
printf("Breakpoint set at 0x%p!\n", entry);
else
printf("Failed to set breakpoint at 0x%p...\b", entry);

View File

@ -7,7 +7,7 @@
static void testDebugger()
{
#ifdef _WIN64
wchar_t szFilePath[256] = L"c:\\test64.exe";
wchar_t szFilePath[256] = L"c:\\MembpTest_x64.exe";
#else //x86
wchar_t szFilePath[256] = L"c:\\test32.exe";
#endif //_WIN64
@ -161,7 +161,7 @@ static void testCorkami()
int main()
{
testPeFile(L"C:\\test64.exe");
testDebugger();
//testCorkami();
//testPeFile(L"c:\\!exclude\\pe\\bin\\appendedhdr.exe");
puts("");