Skip to content

Commit 768ee4a

Browse files
committed
revert Step Next behavior and remove Step Over -> Next mapping
1 parent 4bab5c7 commit 768ee4a

File tree

3 files changed

+1
-79
lines changed

3 files changed

+1
-79
lines changed

core/debug/debug.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,6 @@ void debug_step(int mode, uint32_t addr) {
182182
debug.stepOut = debug.stackIndex;
183183
break;
184184
case DBG_STEP_NEXT:
185-
gui_debug_close();
186-
debug.step = true;
187-
debug.stepOver = false;
188-
debug.tempExec = ~0u;
189-
break;
190185
case DBG_RUN_UNTIL:
191186
gui_debug_close();
192187
debug.tempExec = addr;

gui/qt/debugger.cpp

Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include <QtGui/QWindow>
4141
#include <QtGui/QScreen>
4242
#include <algorithm>
43-
#include <array>
4443

4544
#ifdef _MSC_VER
4645
#include <direct.h>
@@ -52,62 +51,7 @@
5251
const QString MainWindow::DEBUG_UNSET_ADDR = QStringLiteral("XXXXXX");
5352
const QString MainWindow::DEBUG_UNSET_PORT = QStringLiteral("XXXX");
5453

55-
namespace {
56-
constexpr uint8_t OP_CALL = 0xCD;
57-
constexpr uint8_t OP_RET = 0xC9;
58-
constexpr uint8_t OP_JP_HL = 0xE9;
59-
constexpr uint8_t OP_PREFIX_ED = 0xED;
60-
constexpr uint8_t OP_PREFIX_DD = 0xDD;
61-
constexpr uint8_t OP_PREFIX_FD = 0xFD;
62-
constexpr uint8_t OP_DJNZ = 0x10;
63-
constexpr uint8_t OP_JR = 0x18;
64-
constexpr uint8_t OP_JR_NZ = 0x20;
65-
constexpr uint8_t OP_JR_Z = 0x28;
66-
constexpr uint8_t OP_JR_NC = 0x30;
67-
constexpr uint8_t OP_JR_C = 0x38;
68-
constexpr uint8_t OP_JP = 0xC3;
69-
70-
constexpr uint8_t OP_RETN_ED = 0x45;
71-
constexpr uint8_t OP_RETI_ED = 0x4D;
72-
73-
constexpr uint8_t CF_NONE = 0;
74-
constexpr uint8_t CF_CALL = 1u << 0;
75-
constexpr uint8_t CF_RET = 1u << 1;
76-
constexpr uint8_t CF_JUMP = 1u << 2;
77-
constexpr uint8_t CF_RST = 1u << 3;
78-
79-
constexpr auto kCtrlLut = []{
80-
std::array<uint8_t, 256> lut{};
81-
// CALL nn and CALL cc,nn
82-
lut[OP_CALL] |= CF_CALL; lut[0xC4] |= CF_CALL; lut[0xCC] |= CF_CALL; lut[0xD4] |= CF_CALL; lut[0xDC] |= CF_CALL;
83-
lut[0xE4] |= CF_CALL; lut[0xEC] |= CF_CALL; lut[0xF4] |= CF_CALL; lut[0xFC] |= CF_CALL;
84-
// RET
85-
lut[OP_RET] |= CF_RET;
86-
// JP nn and JP cc, nn
87-
lut[OP_JP] |= CF_JUMP;
88-
lut[0xC2] |= CF_JUMP; lut[0xCA] |= CF_JUMP; lut[0xD2] |= CF_JUMP; lut[0xDA] |= CF_JUMP;
89-
lut[0xE2] |= CF_JUMP; lut[0xEA] |= CF_JUMP; lut[0xF2] |= CF_JUMP; lut[0xFA] |= CF_JUMP;
90-
// JR e and JR cc,e
91-
lut[OP_JR] |= CF_JUMP; lut[OP_JR_NZ] |= CF_JUMP; lut[OP_JR_Z] |= CF_JUMP; lut[OP_JR_NC] |= CF_JUMP; lut[OP_JR_C] |= CF_JUMP;
92-
// DJNZ
93-
lut[OP_DJNZ] |= CF_JUMP;
94-
// JP (HL)
95-
lut[OP_JP_HL] |= CF_JUMP;
96-
// RST t (C7, CF, D7, DF, E7, EF, F7, FF)
97-
lut[0xC7] |= CF_RST; lut[0xCF] |= CF_RST; lut[0xD7] |= CF_RST; lut[0xDF] |= CF_RST;
98-
lut[0xE7] |= CF_RST; lut[0xEF] |= CF_RST; lut[0xF7] |= CF_RST; lut[0xFF] |= CF_RST;
99-
return lut;
100-
}();
101-
102-
bool isCtrlFlowOpcode(uint8_t b0, uint8_t b1) {
103-
if (kCtrlLut[b0] != CF_NONE) { return true; }
104-
// RETN/RETI
105-
if (b0 == OP_PREFIX_ED && (b1 == OP_RETN_ED || b1 == OP_RETI_ED)) { return true; }
106-
// JP (IX)/(IY)
107-
if ((b0 == OP_PREFIX_DD || b0 == OP_PREFIX_FD) && b1 == OP_JP_HL) { return true; }
108-
return false;
109-
}
110-
}
54+
// (Removed control-flow opcode classification used for Step Over -> Step Next mapping)
11155

11256
// -----------------------------------------------
11357
// Debugger Initialization
@@ -153,10 +97,6 @@ void MainWindow::debugInit() {
15397
// ------------------------------------------------
15498

15599
void MainWindow::debugDisable() {
156-
if (m_suppressDebugCloseOnce) {
157-
m_suppressDebugCloseOnce = false;
158-
return;
159-
}
160100
guiDebug = false;
161101
debugGuiState(false);
162102
}
@@ -175,16 +115,6 @@ void MainWindow::debugStep(int mode) {
175115

176116
m_stepCtx.active = true;
177117
m_stepCtx.seqNext = static_cast<uint32_t>(disasm.next);
178-
179-
if (mode == DBG_STEP_OVER) {
180-
const uint32_t pc0 = cpu.registers.PC;
181-
const uint8_t b0 = mem_peek_byte(pc0);
182-
const uint8_t b1 = mem_peek_byte(pc0 + 1);
183-
if (!isCtrlFlowOpcode(b0, b1)) {
184-
mode = DBG_STEP_NEXT;
185-
m_suppressDebugCloseOnce = true;
186-
}
187-
}
188118
debug_step(mode, static_cast<uint32_t>(disasm.next));
189119
}
190120
emu.resume();

gui/qt/mainwindow.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -962,9 +962,6 @@ private slots:
962962
uint32_t seqNext = 0; // sequential next PC at step start
963963
} m_stepCtx;
964964

965-
// suppression to avoid GUI close/reopen flicker when mapping Step Over to Step Next
966-
bool m_suppressDebugCloseOnce = false;
967-
968965
#ifdef LIBUSB_SUPPORT
969966
libusb_context *m_usbContext = nullptr;
970967
libusb_hotplug_callback_handle m_usbHotplugCallbackHandle{};

0 commit comments

Comments
 (0)