Fix bugs with singleshoot breakpoints
This commit is contained in:
parent
e7edb6ad34
commit
4dfeca4078
|
@ -67,10 +67,10 @@ void ExceptionDirectoryAnalysis::Analyse()
|
|||
EnumerateFunctionRuntimeEntries64([&](PRUNTIME_FUNCTION Function)
|
||||
{
|
||||
auto funcAddr = mModuleBase + Function->BeginAddress;
|
||||
auto funcEnd = mModuleBase + Function->EndAddress;
|
||||
auto funcEnd = mModuleBase + Function->EndAddress - 1;
|
||||
|
||||
// If within limits...
|
||||
if(inRange(funcAddr) && inRange(funcEnd))
|
||||
if(inRange(funcAddr) && inRange(funcEnd) && funcAddr <= funcEnd)
|
||||
mFunctions.push_back({ funcAddr, funcEnd });
|
||||
|
||||
return true;
|
||||
|
|
|
@ -507,13 +507,36 @@ bool BpSetSingleshoot(duint Address, BP_TYPE Type, bool singleshoot)
|
|||
ASSERT_DEBUGGING("Command function call");
|
||||
EXCLUSIVE_ACQUIRE(LockBreakpoints);
|
||||
|
||||
// Set breakpoint fast resume
|
||||
// Set breakpoint singleshoot
|
||||
BREAKPOINT* bpInfo = BpInfoFromAddr(Type, Address);
|
||||
|
||||
if(!bpInfo)
|
||||
return false;
|
||||
|
||||
bpInfo->singleshoot = singleshoot;
|
||||
// Update singleshoot information in TitanEngine
|
||||
switch(Type)
|
||||
{
|
||||
case BPNORMAL:
|
||||
bpInfo->titantype = (bpInfo->titantype & ~UE_SINGLESHOOT) | (singleshoot ? UE_SINGLESHOOT : 0);
|
||||
if(IsBPXEnabled(Address) && bpInfo->enabled)
|
||||
{
|
||||
if(!DeleteBPX(Address))
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete breakpoint failed (DeleteBPX): %p\n"), Address);
|
||||
if(!SetBPX(Address, bpInfo->titantype, (void*)cbUserBreakpoint))
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Error setting breakpoint at %p! (SetBPX)\n"), Address);
|
||||
}
|
||||
break;
|
||||
case BPMEMORY:
|
||||
if(bpInfo->enabled)
|
||||
{
|
||||
if(!RemoveMemoryBPX(Address, bpInfo->memsize))
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete memory breakpoint failed (RemoveMemoryBPX): %p\n"), Address);
|
||||
if(!SetMemoryBPXEx(Address, bpInfo->memsize, bpInfo->titantype, !singleshoot, (void*)cbMemoryBreakpoint))
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Could not enable memory breakpoint %p (SetMemoryBPXEx)\n"), Address);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,7 @@ static bool cbDisableAllBreakpoints(const BREAKPOINT* bp)
|
|||
return true;
|
||||
}
|
||||
|
||||
// Software breakpoints
|
||||
bool cbDebugSetBPX(int argc, char* argv[]) //bp addr [,name [,type]]
|
||||
{
|
||||
if(IsArgumentsLessThan(argc, 2))
|
||||
|
@ -325,6 +326,7 @@ bool cbDebugDisableBPX(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
|
||||
// Hardware breakpoints
|
||||
static bool cbDeleteAllHardwareBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(bp->type != BPHARDWARE)
|
||||
|
@ -627,6 +629,7 @@ bool cbDebugDisableHardwareBreakpoint(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
|
||||
// Memory breakpoints
|
||||
static bool cbDeleteAllMemoryBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(bp->type != BPMEMORY)
|
||||
|
@ -897,6 +900,7 @@ bool cbDebugDisableMemoryBreakpoint(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
|
||||
// DLL breakpoints
|
||||
static bool cbDeleteAllDllBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(bp->type != BPDLL || !bp->enabled)
|
||||
|
@ -1111,6 +1115,7 @@ bool cbDebugBpDllDisable(int argc, char* argv[])
|
|||
return true;
|
||||
}
|
||||
|
||||
// Exception breakpoints
|
||||
static bool cbDeleteAllExceptionBreakpoints(const BREAKPOINT* bp)
|
||||
{
|
||||
if(bp->type != BPEXCEPTION)
|
||||
|
|
|
@ -760,7 +760,14 @@ static void handleBreakCondition(const BREAKPOINT & bp, const void* ExceptionAdd
|
|||
if(doBreak)
|
||||
{
|
||||
if(bp.singleshoot)
|
||||
{
|
||||
BpDelete(bp.addr, bp.type);
|
||||
if(bp.type == BPHARDWARE) // Remove this singleshoot hardware breakpoint
|
||||
{
|
||||
if(TITANDRXVALID(bp.titantype) && !DeleteHardwareBreakPoint(TITANGETDRX(bp.titantype)))
|
||||
dprintf(QT_TRANSLATE_NOOP("DBG", "Delete hardware breakpoint failed: %p (DeleteHardwareBreakPoint)\n"), bp.addr);
|
||||
}
|
||||
}
|
||||
if(!bp.silent)
|
||||
{
|
||||
switch(bp.type)
|
||||
|
|
Loading…
Reference in New Issue