mirror of https://github.com/x64dbg/GleeBug
simple software (0xCC) breakpoints working + examples with lambda functions
This commit is contained in:
parent
a2fbad713b
commit
26c71cc6e4
|
|
@ -24,6 +24,16 @@ namespace GleeBug
|
||||||
//set continue status
|
//set continue status
|
||||||
_continueStatus = DBG_CONTINUE;
|
_continueStatus = DBG_CONTINUE;
|
||||||
|
|
||||||
|
//set back the instruction pointer
|
||||||
|
_registers->Gip = info.address;
|
||||||
|
|
||||||
|
//restore the original breakpoint byte and do an internal step
|
||||||
|
_process->MemWrite(info.address, info.internal.software.oldbytes, info.internal.software.size);
|
||||||
|
_thread->StepInternal(std::bind([this, info]()
|
||||||
|
{
|
||||||
|
_process->MemWrite(info.address, info.internal.software.newbytes, info.internal.software.size);
|
||||||
|
}));
|
||||||
|
|
||||||
//call the generic callback
|
//call the generic callback
|
||||||
cbBreakpoint(info);
|
cbBreakpoint(info);
|
||||||
|
|
||||||
|
|
@ -39,7 +49,7 @@ namespace GleeBug
|
||||||
if (_thread->isInternalStepping) //handle internal steps
|
if (_thread->isInternalStepping) //handle internal steps
|
||||||
{
|
{
|
||||||
//set internal status
|
//set internal status
|
||||||
_thread->isSingleStepping = false;
|
_thread->isInternalStepping = false;
|
||||||
_continueStatus = DBG_CONTINUE;
|
_continueStatus = DBG_CONTINUE;
|
||||||
|
|
||||||
//call the internal step callback
|
//call the internal step callback
|
||||||
|
|
|
||||||
|
|
@ -8,9 +8,15 @@ using namespace GleeBug;
|
||||||
class MyDebugger : public Debugger
|
class MyDebugger : public Debugger
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void myBreakpoint(const BreakpointInfo & info)
|
void cbEntryBreakpoint(const BreakpointInfo & info)
|
||||||
{
|
{
|
||||||
puts("myBreakpoint()");
|
printf("Reached entry breakpoint! GIP: 0x%p\n",
|
||||||
|
_registers->Gip());
|
||||||
|
_thread->StepInto(std::bind([this]()
|
||||||
|
{
|
||||||
|
printf("Step after entry breakpoint! GIP: 0x%p\n",
|
||||||
|
_registers->Gip());
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const ProcessInfo & process) override
|
void cbCreateProcessEvent(const CREATE_PROCESS_DEBUG_INFO & createProcess, const ProcessInfo & process) override
|
||||||
|
|
@ -19,7 +25,7 @@ protected:
|
||||||
printf("Process %d created with entry 0x%p\n",
|
printf("Process %d created with entry 0x%p\n",
|
||||||
_debugEvent.dwProcessId,
|
_debugEvent.dwProcessId,
|
||||||
entry);
|
entry);
|
||||||
if(_process->SetBreakpoint(entry, this, &MyDebugger::myBreakpoint))
|
if(_process->SetBreakpoint(entry, this, &MyDebugger::cbEntryBreakpoint))
|
||||||
printf("Breakpoint set at 0x%p!\n", entry);
|
printf("Breakpoint set at 0x%p!\n", entry);
|
||||||
else
|
else
|
||||||
printf("Failed to set breakpoint at 0x%p...\b", entry);
|
printf("Failed to set breakpoint at 0x%p...\b", entry);
|
||||||
|
|
@ -81,25 +87,17 @@ protected:
|
||||||
rip.dwError);
|
rip.dwError);
|
||||||
}
|
}
|
||||||
|
|
||||||
void boobs()
|
void cbStepSystem()
|
||||||
{
|
{
|
||||||
printf("(.)Y(.) 0x%p\n",
|
printf("Reached step after system breakpoint, GIP: 0x%p!\n",
|
||||||
_registers->Gip.Get());
|
_registers->Gip());
|
||||||
}
|
|
||||||
|
|
||||||
void gax()
|
|
||||||
{
|
|
||||||
printf("GAX: 0x%p = 0x%p = 0x%p\n",
|
|
||||||
_registers->Get(Registers::R::GAX),
|
|
||||||
_registers->Gax.Get(),
|
|
||||||
_registers->Gax());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cbSystemBreakpoint() override
|
void cbSystemBreakpoint() override
|
||||||
{
|
{
|
||||||
printf("System breakpoint reached, CIP: 0x%p\n",
|
printf("System breakpoint reached, GIP: 0x%p\n",
|
||||||
_registers->Gip.Get());
|
_registers->Gip.Get());
|
||||||
_thread->StepInto(this, &MyDebugger::boobs);
|
_thread->StepInto(this, &MyDebugger::cbStepSystem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cbInternalError(const std::string & error) override
|
void cbInternalError(const std::string & error) override
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue