mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-19 13:42:00 +00:00
Merge pull request #16397 from unknownbrackets/meminfo
Debugger: Combine mem info on duplicates
This commit is contained in:
commit
cd56425c73
@ -405,6 +405,29 @@ static inline uint32_t NormalizeAddress(uint32_t addr) {
|
||||
return addr & 0x3FFFFFFF;
|
||||
}
|
||||
|
||||
static inline bool MergeRecentMemInfo(const PendingNotifyMem &info, size_t copyLength) {
|
||||
if (pendingNotifies.size() < 4)
|
||||
return false;
|
||||
|
||||
for (size_t i = 1; i <= 4; ++i) {
|
||||
auto &prev = pendingNotifies[pendingNotifies.size() - i];
|
||||
if (prev.start >= info.start + info.size || prev.start + prev.size <= info.start)
|
||||
continue;
|
||||
|
||||
// This means there's overlap, but not a match, so we can't combine any.
|
||||
if (prev.start != info.start || prev.size > info.size)
|
||||
return false;
|
||||
|
||||
memcpy(prev.tag, info.tag, copyLength + 1);
|
||||
prev.size = info.size;
|
||||
prev.ticks = info.ticks;
|
||||
prev.pc = info.pc;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void NotifyMemInfoPC(MemBlockFlags flags, uint32_t start, uint32_t size, uint32_t pc, const char *tagStr, size_t strLength) {
|
||||
if (size == 0) {
|
||||
return;
|
||||
@ -427,14 +450,17 @@ void NotifyMemInfoPC(MemBlockFlags flags, uint32_t start, uint32_t size, uint32_
|
||||
info.tag[copyLength] = 0;
|
||||
|
||||
std::lock_guard<std::mutex> guard(pendingMutex);
|
||||
if (start < 0x08000000) {
|
||||
pendingNotifyMinAddr1 = std::min(pendingNotifyMinAddr1.load(), start);
|
||||
pendingNotifyMaxAddr1 = std::max(pendingNotifyMaxAddr1.load(), start + size);
|
||||
} else {
|
||||
pendingNotifyMinAddr2 = std::min(pendingNotifyMinAddr2.load(), start);
|
||||
pendingNotifyMaxAddr2 = std::max(pendingNotifyMaxAddr2.load(), start + size);
|
||||
// Sometimes we get duplicates, quickly check.
|
||||
if (!MergeRecentMemInfo(info, copyLength)) {
|
||||
if (start < 0x08000000) {
|
||||
pendingNotifyMinAddr1 = std::min(pendingNotifyMinAddr1.load(), start);
|
||||
pendingNotifyMaxAddr1 = std::max(pendingNotifyMaxAddr1.load(), start + size);
|
||||
} else {
|
||||
pendingNotifyMinAddr2 = std::min(pendingNotifyMinAddr2.load(), start);
|
||||
pendingNotifyMaxAddr2 = std::max(pendingNotifyMaxAddr2.load(), start + size);
|
||||
}
|
||||
pendingNotifies.push_back(info);
|
||||
}
|
||||
pendingNotifies.push_back(info);
|
||||
needFlush = pendingNotifies.size() > MAX_PENDING_NOTIFIES;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user