mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Made rehupping of memory breakpoints more conservative
This commit is contained in:
parent
3adf9a144e
commit
5f339d811d
2 changed files with 11 additions and 0 deletions
|
@ -531,6 +531,7 @@ WinDebugger::WinDebugger(DebugManager* debugManager) : mDbgSymSrv(this)
|
||||||
{
|
{
|
||||||
mFreeMemoryBreakIndices.push_back(i);
|
mFreeMemoryBreakIndices.push_back(i);
|
||||||
}
|
}
|
||||||
|
mMemoryBreakpointVersion = 0;
|
||||||
|
|
||||||
SYSTEM_INFO systemInfo;
|
SYSTEM_INFO systemInfo;
|
||||||
GetSystemInfo(&systemInfo);
|
GetSystemInfo(&systemInfo);
|
||||||
|
@ -621,6 +622,9 @@ void WinDebugger::ThreadRestoreUnpause()
|
||||||
|
|
||||||
void WinDebugger::UpdateThreadDebugRegisters(WdThreadInfo* threadInfo)
|
void WinDebugger::UpdateThreadDebugRegisters(WdThreadInfo* threadInfo)
|
||||||
{
|
{
|
||||||
|
if (threadInfo->mMemoryBreakpointVersion == mMemoryBreakpointVersion)
|
||||||
|
return;
|
||||||
|
|
||||||
auto threadId = threadInfo->mHThread;
|
auto threadId = threadInfo->mHThread;
|
||||||
|
|
||||||
BF_CONTEXT lcContext;
|
BF_CONTEXT lcContext;
|
||||||
|
@ -655,6 +659,7 @@ void WinDebugger::UpdateThreadDebugRegisters(WdThreadInfo* threadInfo)
|
||||||
}
|
}
|
||||||
bool worked = BF_SetThreadContext(threadId, &lcContext) != 0;
|
bool worked = BF_SetThreadContext(threadId, &lcContext) != 0;
|
||||||
BF_ASSERT(worked || (mRunState == RunState_Terminating) || (mRunState == RunState_Terminated));
|
BF_ASSERT(worked || (mRunState == RunState_Terminating) || (mRunState == RunState_Terminated));
|
||||||
|
threadInfo->mMemoryBreakpointVersion = mMemoryBreakpointVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinDebugger::UpdateThreadDebugRegisters()
|
void WinDebugger::UpdateThreadDebugRegisters()
|
||||||
|
@ -3338,6 +3343,7 @@ void WinDebugger::CheckBreakpoint(WdBreakpoint* wdBreakpoint)
|
||||||
mMemoryBreakpoints[memoryBreakIdx].mByteCount = wantBytes[i];
|
mMemoryBreakpoints[memoryBreakIdx].mByteCount = wantBytes[i];
|
||||||
mMemoryBreakpoints[memoryBreakIdx].mOfs = curOfs;
|
mMemoryBreakpoints[memoryBreakIdx].mOfs = curOfs;
|
||||||
curOfs += wantBytes[i];
|
curOfs += wantBytes[i];
|
||||||
|
mMemoryBreakpointVersion++;
|
||||||
|
|
||||||
wdBreakpoint->mMemoryBreakpointInfo->mMemoryWatchSlotBitmap |= 1<<memoryBreakIdx;
|
wdBreakpoint->mMemoryBreakpointInfo->mMemoryWatchSlotBitmap |= 1<<memoryBreakIdx;
|
||||||
}
|
}
|
||||||
|
@ -3572,6 +3578,7 @@ void WinDebugger::DeleteBreakpoint(Breakpoint* breakpoint)
|
||||||
{
|
{
|
||||||
mFreeMemoryBreakIndices.push_back(memoryWatchSlot);
|
mFreeMemoryBreakIndices.push_back(memoryWatchSlot);
|
||||||
mMemoryBreakpoints[memoryWatchSlot] = WdMemoryBreakpointBind();
|
mMemoryBreakpoints[memoryWatchSlot] = WdMemoryBreakpointBind();
|
||||||
|
mMemoryBreakpointVersion++;
|
||||||
UpdateThreadDebugRegisters();
|
UpdateThreadDebugRegisters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3638,6 +3645,7 @@ void WinDebugger::DetachBreakpoint(Breakpoint* breakpoint)
|
||||||
{
|
{
|
||||||
mFreeMemoryBreakIndices.push_back(memoryWatchSlot);
|
mFreeMemoryBreakIndices.push_back(memoryWatchSlot);
|
||||||
mMemoryBreakpoints[memoryWatchSlot] = WdMemoryBreakpointBind();
|
mMemoryBreakpoints[memoryWatchSlot] = WdMemoryBreakpointBind();
|
||||||
|
mMemoryBreakpointVersion++;
|
||||||
UpdateThreadDebugRegisters();
|
UpdateThreadDebugRegisters();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,6 +251,7 @@ public:
|
||||||
addr_target mStoppedAtAddress;
|
addr_target mStoppedAtAddress;
|
||||||
addr_target mIsAtBreakpointAddress;
|
addr_target mIsAtBreakpointAddress;
|
||||||
addr_target mBreakpointAddressContinuing;
|
addr_target mBreakpointAddressContinuing;
|
||||||
|
int mMemoryBreakpointVersion;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WdThreadInfo()
|
WdThreadInfo()
|
||||||
|
@ -267,6 +268,7 @@ public:
|
||||||
mIsAtBreakpointAddress = 0;
|
mIsAtBreakpointAddress = 0;
|
||||||
mStoppedAtAddress = 0;
|
mStoppedAtAddress = 0;
|
||||||
mBreakpointAddressContinuing = 0;
|
mBreakpointAddressContinuing = 0;
|
||||||
|
mMemoryBreakpointVersion = 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -454,6 +456,7 @@ public:
|
||||||
DWORD mDebuggerThreadId;
|
DWORD mDebuggerThreadId;
|
||||||
|
|
||||||
WdMemoryBreakpointBind mMemoryBreakpoints[4];
|
WdMemoryBreakpointBind mMemoryBreakpoints[4];
|
||||||
|
int mMemoryBreakpointVersion;
|
||||||
Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr
|
Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr
|
||||||
Array<WdBreakpoint*> mBreakpoints;
|
Array<WdBreakpoint*> mBreakpoints;
|
||||||
Dictionary<addr_target, WdBreakpoint*> mBreakpointAddrMap;
|
Dictionary<addr_target, WdBreakpoint*> mBreakpointAddrMap;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue