mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 03:03:50 +01:00
Rework the step functions.
This commit is contained in:
1 parent
a730f01c53
commit
828523165f
2 files changed
+25
-14
No files matched your search
+14
-11
@@ -55,7 +55,7 @@ static std::condition_variable m_StepCond;
|
||||
static std::mutex m_hStepMutex;
|
||||
static std::condition_variable m_InactiveCond;
|
||||
static std::mutex m_hInactiveMutex;
|
||||
static bool singleStepPending = false;
|
||||
static int g_singleStepsPending = 0;
|
||||
static int steppingCounter = 0;
|
||||
static const char *steppingReason = "";
|
||||
static uint32_t steppingAddress = 0;
|
||||
@@ -229,7 +229,7 @@ void Core_RunLoop(GraphicsContext *ctx) {
|
||||
|
||||
void Core_DoSingleStep() {
|
||||
std::lock_guard<std::mutex> guard(m_hStepMutex);
|
||||
singleStepPending = true;
|
||||
g_singleStepsPending++;
|
||||
m_StepCond.notify_all();
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ u32 Core_PerformStep(DebugInterface *cpu, CPUStepType stepType, int stepSize) {
|
||||
for (int i = 0; i < (newAddress - currentPc) / 4; i++) {
|
||||
Core_DoSingleStep();
|
||||
}
|
||||
return newAddress;
|
||||
return cpu->GetPC();
|
||||
}
|
||||
case CPUStepType::Over:
|
||||
{
|
||||
@@ -316,17 +316,17 @@ u32 Core_PerformStep(DebugInterface *cpu, CPUStepType stepType, int stepSize) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool Core_WaitStepping() {
|
||||
static inline int Core_WaitStepping() {
|
||||
std::unique_lock<std::mutex> guard(m_hStepMutex);
|
||||
// We only wait 16ms so that we can still draw UI or react to events.
|
||||
double sleepStart = time_now_d();
|
||||
if (!singleStepPending && coreState == CORE_STEPPING)
|
||||
if (!g_singleStepsPending && coreState == CORE_STEPPING)
|
||||
m_StepCond.wait_for(guard, std::chrono::milliseconds(16));
|
||||
double sleepEnd = time_now_d();
|
||||
DisplayNotifySleep(sleepEnd - sleepStart);
|
||||
|
||||
bool result = singleStepPending;
|
||||
singleStepPending = false;
|
||||
int result = g_singleStepsPending;
|
||||
g_singleStepsPending = 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -352,13 +352,16 @@ void Core_ProcessStepping() {
|
||||
}
|
||||
|
||||
// Need to check inside the lock to avoid races.
|
||||
bool doStep = Core_WaitStepping();
|
||||
int doSteps = Core_WaitStepping();
|
||||
|
||||
// We may still be stepping without singleStepPending to process a save state.
|
||||
if (doStep && coreState == CORE_STEPPING) {
|
||||
if (doSteps && coreState == CORE_STEPPING) {
|
||||
Core_ResetException();
|
||||
currentMIPS->SingleStep();
|
||||
steppingCounter++;
|
||||
|
||||
for (int i = 0; i < doSteps; i++) {
|
||||
currentMIPS->SingleStep();
|
||||
steppingCounter++;
|
||||
}
|
||||
|
||||
// Update disasm dialog.
|
||||
System_Notify(SystemNotification::DISASSEMBLY);
|
||||
|
||||
Reference in new issue
Block a user