Skip to content

Commit

Permalink
Merge pull request #16988 from unknownbrackets/debugger
Browse files Browse the repository at this point in the history
Debugger: Lock memory during stack walk
  • Loading branch information
hrydgard committed Feb 23, 2023
2 parents febba18 + cd3fc26 commit 9d5b956
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
2 changes: 2 additions & 0 deletions GPU/Software/DrawPixel.cpp
Expand Up @@ -802,10 +802,12 @@ SingleFunc PixelJitCache::GenericSingle(const PixelFuncID &id) {
}

thread_local PixelJitCache::LastCache PixelJitCache::lastSingle_;
int PixelJitCache::clearGen_ = 0;

// 256k should be plenty of space for plenty of variations.
PixelJitCache::PixelJitCache() : CodeBlock(1024 * 64 * 4), cache_(64) {
lastSingle_.gen = -1;
clearGen_++;
}

void PixelJitCache::Clear() {
Expand Down
2 changes: 1 addition & 1 deletion GPU/Software/DrawPixel.h
Expand Up @@ -128,7 +128,7 @@ class PixelJitCache : public Rasterizer::CodeBlock {
DenseHashMap<size_t, SingleFunc, nullptr> cache_;
std::unordered_map<PixelFuncID, const u8 *> addresses_;
std::unordered_set<PixelFuncID> compileQueue_;
int clearGen_ = 0;
static int clearGen_;
static thread_local LastCache lastSingle_;

const u8 *constBlendHalf_11_4s_ = nullptr;
Expand Down
2 changes: 2 additions & 0 deletions GPU/Software/Sampler.cpp
Expand Up @@ -109,12 +109,14 @@ FetchFunc GetFetchFunc(SamplerID id, BinManager *binner) {
thread_local SamplerJitCache::LastCache SamplerJitCache::lastFetch_;
thread_local SamplerJitCache::LastCache SamplerJitCache::lastNearest_;
thread_local SamplerJitCache::LastCache SamplerJitCache::lastLinear_;
int SamplerJitCache::clearGen_ = 0;

// 256k should be enough.
SamplerJitCache::SamplerJitCache() : Rasterizer::CodeBlock(1024 * 64 * 4), cache_(64) {
lastFetch_.gen = -1;
lastNearest_.gen = -1;
lastLinear_.gen = -1;
clearGen_++;
}

void SamplerJitCache::Clear() {
Expand Down
2 changes: 1 addition & 1 deletion GPU/Software/Sampler.h
Expand Up @@ -147,7 +147,7 @@ class SamplerJitCache : public Rasterizer::CodeBlock {
DenseHashMap<size_t, NearestFunc, nullptr> cache_;
std::unordered_map<SamplerID, const u8 *> addresses_;
std::unordered_set<SamplerID> compileQueue_;
int clearGen_ = 0;
static int clearGen_;
static thread_local LastCache lastFetch_;
static thread_local LastCache lastNearest_;
static thread_local LastCache lastLinear_;
Expand Down
7 changes: 3 additions & 4 deletions Windows/Debugger/Debugger_Disasm.cpp
Expand Up @@ -291,11 +291,10 @@ void CDisasm::stepOver()
UpdateDialog();
}

void CDisasm::stepOut()
{
if (!PSP_IsInited()) {
void CDisasm::stepOut() {
auto memLock = Memory::Lock();
if (!PSP_IsInited())
return;
}

auto threads = GetThreadsInfo();

Expand Down
7 changes: 5 additions & 2 deletions Windows/Debugger/Debugger_Lists.cpp
Expand Up @@ -700,8 +700,11 @@ void CtrlStackTraceView::OnDoubleClick(int itemIndex, int column)
SendMessage(GetParent(GetHandle()),WM_DEB_GOTOWPARAM,frames[itemIndex].pc,0);
}

void CtrlStackTraceView::loadStackTrace()
{
void CtrlStackTraceView::loadStackTrace() {
auto memLock = Memory::Lock();
if (!PSP_IsInited())
return;

auto threads = GetThreadsInfo();

u32 entry = 0, stackTop = 0;
Expand Down

0 comments on commit 9d5b956

Please sign in to comment.