mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-19 09:19:05 +02:00
Debugger: Include source tag in memcpys.
This commit is contained in:
1 parent
e36d09acc3
commit
aa89ed5111
5 files changed
+37
-18
No files matched your search
@@ -433,6 +433,14 @@ std::vector<MemBlockInfo> FindMemInfoByFlag(MemBlockFlags flags, uint32_t start,
|
||||
return results;
|
||||
}
|
||||
|
||||
std::string GetMemWriteTagAt(uint32_t start, uint32_t size) {
|
||||
std::vector<MemBlockInfo> memRangeInfo = FindMemInfoByFlag(MemBlockFlags::WRITE, start, size);
|
||||
for (auto range : memRangeInfo) {
|
||||
return range.tag;
|
||||
}
|
||||
return "none";
|
||||
}
|
||||
|
||||
void MemBlockInfoInit() {
|
||||
std::lock_guard<std::mutex> guard(pendingMutex);
|
||||
pendingNotifies.reserve(MAX_PENDING_NOTIFIES);
|
||||
|
||||
@@ -63,6 +63,8 @@ inline void NotifyMemInfo(MemBlockFlags flags, uint32_t start, uint32_t size, co
|
||||
std::vector<MemBlockInfo> FindMemInfo(uint32_t start, uint32_t size);
|
||||
std::vector<MemBlockInfo> FindMemInfoByFlag(MemBlockFlags flags, uint32_t start, uint32_t size);
|
||||
|
||||
std::string GetMemWriteTagAt(uint32_t start, uint32_t size);
|
||||
|
||||
void MemBlockInfoInit();
|
||||
void MemBlockInfoShutdown();
|
||||
void MemBlockInfoDoState(PointerWrap &p);
|
||||
+15
-10
@@ -156,8 +156,9 @@ static int Replace_memcpy() {
|
||||
}
|
||||
RETURN(destPtr);
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, "ReplaceMemcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, "ReplaceMemcpy");
|
||||
const std::string tag = "ReplaceMemcpy/" + GetMemWriteTagAt(srcPtr, bytes);
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size());
|
||||
|
||||
return 10 + bytes / 4; // approximation
|
||||
}
|
||||
@@ -198,8 +199,9 @@ static int Replace_memcpy_jak() {
|
||||
currentMIPS->r[MIPS_REG_A3] = destPtr + bytes;
|
||||
RETURN(destPtr);
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, "ReplaceMemcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, "ReplaceMemcpy");
|
||||
const std::string tag = "ReplaceMemcpy/" + GetMemWriteTagAt(srcPtr, bytes);
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size());
|
||||
|
||||
return 5 + bytes * 8 + 2; // approximation. This is a slow memcpy - a byte copy loop..
|
||||
}
|
||||
@@ -226,8 +228,9 @@ static int Replace_memcpy16() {
|
||||
}
|
||||
RETURN(destPtr);
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, "ReplaceMemcpy16");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, "ReplaceMemcpy16");
|
||||
const std::string tag = "ReplaceMemcpy16/" + GetMemWriteTagAt(srcPtr, bytes);
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size());
|
||||
|
||||
return 10 + bytes / 4; // approximation
|
||||
}
|
||||
@@ -264,8 +267,9 @@ static int Replace_memcpy_swizzled() {
|
||||
|
||||
RETURN(0);
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, pitch * h, "ReplaceMemcpySwizzle");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, pitch * h, "ReplaceMemcpySwizzle");
|
||||
const std::string tag = "ReplaceMemcpySwizzle/" + GetMemWriteTagAt(srcPtr, pitch * h);
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, pitch * h, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, pitch * h, tag.c_str(), tag.size());
|
||||
|
||||
return 10 + (pitch * h) / 4; // approximation
|
||||
}
|
||||
@@ -292,8 +296,9 @@ static int Replace_memmove() {
|
||||
}
|
||||
RETURN(destPtr);
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, "ReplaceMemmove");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, "ReplaceMemmove");
|
||||
const std::string tag = "ReplaceMemmove/" + GetMemWriteTagAt(srcPtr, bytes);
|
||||
NotifyMemInfo(MemBlockFlags::READ, srcPtr, bytes, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, destPtr, bytes, tag.c_str(), tag.size());
|
||||
|
||||
return 10 + bytes / 4; // approximation
|
||||
}
|
||||
|
||||
@@ -658,8 +658,9 @@ static u32 sceKernelMemcpy(u32 dst, u32 src, u32 size)
|
||||
}
|
||||
}
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, "KernelMemcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, "KernelMemcpy");
|
||||
const std::string tag = "KernelMemcpy/" + GetMemWriteTagAt(src, size);
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tag.c_str(), tag.size());
|
||||
|
||||
return dst;
|
||||
}
|
||||
@@ -690,8 +691,9 @@ static u32 sysclib_memcpy(u32 dst, u32 src, u32 size) {
|
||||
if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
|
||||
memcpy(Memory::GetPointer(dst), Memory::GetPointer(src), size);
|
||||
}
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, "KernelMemcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, "KernelMemcpy");
|
||||
const std::string tag = "KernelMemcpy/" + GetMemWriteTagAt(src, size);
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tag.c_str(), tag.size());
|
||||
return dst;
|
||||
}
|
||||
|
||||
@@ -790,8 +792,9 @@ static u32 sysclib_memmove(u32 dst, u32 src, u32 size) {
|
||||
if (Memory::IsValidRange(dst, size) && Memory::IsValidRange(src, size)) {
|
||||
memmove(Memory::GetPointer(dst), Memory::GetPointer(src), size);
|
||||
}
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, "KernelMemmove");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, "KernelMemmove");
|
||||
const std::string tag = "KernelMemmove/" + GetMemWriteTagAt(src, size);
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dst, size, tag.c_str(), tag.size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+3
-2
@@ -2742,8 +2742,9 @@ bool GPUCommon::PerformMemoryCopy(u32 dest, u32 src, int size) {
|
||||
return true;
|
||||
}
|
||||
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, "GPUMemcpy");
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dest, size, "GPUMemcpy");
|
||||
const std::string tag = "GPUMemcpy/" + GetMemWriteTagAt(src, size);
|
||||
NotifyMemInfo(MemBlockFlags::READ, src, size, tag.c_str(), tag.size());
|
||||
NotifyMemInfo(MemBlockFlags::WRITE, dest, size, tag.c_str(), tag.size());
|
||||
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
|
||||
GPURecord::NotifyMemcpy(dest, src, size);
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user