From 82dd2780f56c1d70d7b280834258e222c2c55c9e Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 26 May 2013 15:54:55 -0700 Subject: [PATCH 1/3] Improve perf when loading a large debug map file. --- Core/Debugger/SymbolMap.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index 1fcb3a235..5d08b3a52 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -262,6 +262,8 @@ void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask) //ListBox_AddString(listbox,"(0x80002000)"); //ListBox_SetItemData(listbox,1,0x80002000); + SendMessage(listbox, WM_SETREDRAW, FALSE, 0); + SendMessage(listbox, LB_INITSTORAGE, (WPARAM)entries.size(), (LPARAM)entries.size() * 30); for (size_t i = 0; i < entries.size(); i++) { if (entries[i].type & symmask) @@ -272,6 +274,8 @@ void SymbolMap::FillSymbolListBox(HWND listbox,SymbolType symmask) ListBox_SetItemData(listbox,index,entries[i].vaddress); } } + SendMessage(listbox, WM_SETREDRAW, TRUE, 0); + RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); ShowWindow(listbox,SW_SHOW); } @@ -289,6 +293,8 @@ void SymbolMap::FillSymbolComboBox(HWND listbox,SymbolType symmask) //ListBox_AddString(listbox,"(0x80002000)"); //ListBox_SetItemData(listbox,1,0x80002000); + SendMessage(listbox, WM_SETREDRAW, FALSE, 0); + SendMessage(listbox, CB_INITSTORAGE, (WPARAM)entries.size(), (LPARAM)entries.size() * 30); for (size_t i = 0; i < entries.size(); i++) { if (entries[i].type & symmask) @@ -299,6 +305,8 @@ void SymbolMap::FillSymbolComboBox(HWND listbox,SymbolType symmask) ComboBox_SetItemData(listbox,index,entries[i].vaddress); } } + SendMessage(listbox, WM_SETREDRAW, TRUE, 0); + RedrawWindow(listbox, NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN); ShowWindow(listbox,SW_SHOW); } From 44e20fb213741ed0091ac509c7aea09531ce123f Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 26 May 2013 16:24:44 -0700 Subject: [PATCH 2/3] Correctly detect bltzal as func calls in debug. --- Core/MIPS/MIPSAnalyst.cpp | 2 +- Core/MIPS/MIPSCodeUtils.cpp | 19 ++++++++++++++++++- Core/MIPS/MIPSCodeUtils.h | 2 ++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index 1a91df291..dd18ac02e 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -353,7 +353,7 @@ namespace MIPSAnalyst } u32 op = Memory::Read_Instruction(addr); - u32 target = GetBranchTarget(addr); + u32 target = GetBranchTargetNoRA(addr); if (target != INVALIDTARGET) { isStraightLeaf = false; diff --git a/Core/MIPS/MIPSCodeUtils.cpp b/Core/MIPS/MIPSCodeUtils.cpp index 3aade2c9f..7701c682f 100644 --- a/Core/MIPS/MIPSCodeUtils.cpp +++ b/Core/MIPS/MIPSCodeUtils.cpp @@ -56,7 +56,24 @@ namespace MIPSCodeUtils return addr + ((signed short)(op&0xFFFF)<<2); } else - return INVALIDTARGET; + return INVALIDTARGET; + } + else + return INVALIDTARGET; + } + + u32 GetBranchTargetNoRA(u32 addr) + { + u32 op = Memory::Read_Instruction(addr); + if (op) + { + u32 info = MIPSGetInfo(op); + if ((info & IS_CONDBRANCH) && !(info & OUT_RA)) + { + return addr + ((signed short)(op&0xFFFF)<<2); + } + else + return INVALIDTARGET; } else return INVALIDTARGET; diff --git a/Core/MIPS/MIPSCodeUtils.h b/Core/MIPS/MIPSCodeUtils.h index 87d61e819..604c14194 100644 --- a/Core/MIPS/MIPSCodeUtils.h +++ b/Core/MIPS/MIPSCodeUtils.h @@ -49,6 +49,8 @@ namespace MIPSCodeUtils { u32 GetCallTarget(u32 addr); u32 GetBranchTarget(u32 addr); + // Ignores bltzal/etc. the change RA. + u32 GetBranchTargetNoRA(u32 addr); u32 GetJumpTarget(u32 addr); u32 GetSureBranchTarget(u32 addr); void RewriteSysCalls(u32 startAddr, u32 endAddr); From 1beb19f827a65fe511185a5f3e42cc76e71471f8 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 26 May 2013 16:29:21 -0700 Subject: [PATCH 3/3] Clear the debug symbol map on shutdown. Instead of polluting the next game. --- Core/HLE/sceKernelModule.cpp | 1 + Core/MIPS/MIPSAnalyst.cpp | 6 ++++++ Core/MIPS/MIPSAnalyst.h | 1 + 3 files changed, 8 insertions(+) diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index 033ea5d4e..7a2a66880 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -296,6 +296,7 @@ void __KernelModuleShutdown() { unresolvedVars.clear(); exportedVars.clear(); + MIPSAnalyst::Shutdown(); } void WriteVarSymbol(u32 exportAddress, u32 relocAddress, u8 type) diff --git a/Core/MIPS/MIPSAnalyst.cpp b/Core/MIPS/MIPSAnalyst.cpp index dd18ac02e..969dad5cf 100644 --- a/Core/MIPS/MIPSAnalyst.cpp +++ b/Core/MIPS/MIPSAnalyst.cpp @@ -264,6 +264,12 @@ namespace MIPSAnalyst map hashToFunction; + void Shutdown() + { + functions.clear(); + hashToFunction.clear(); + } + // hm pointless :P void UpdateHashToFunctionMap() { diff --git a/Core/MIPS/MIPSAnalyst.h b/Core/MIPS/MIPSAnalyst.h index 2cd5f71a3..68d8202fa 100644 --- a/Core/MIPS/MIPSAnalyst.h +++ b/Core/MIPS/MIPSAnalyst.h @@ -62,5 +62,6 @@ namespace MIPSAnalyst bool IsDelaySlotNiceFPU(u32 branchOp, u32 op); bool IsSyscall(u32 op); + void Shutdown(); } // namespace MIPSAnalyst