diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2021-09-22 17:33:08 -0400 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2021-09-22 17:33:27 -0400 |
commit | 3d5033cc533e9090eae3393937079d4b13b5a23b (patch) | |
tree | eba5585dd470fe20fb2f8b581b5c4b59cb02459f /src | |
parent | 401dccf05eb2c35697eb6c7406bb689bfa864609 (diff) |
Make debugger 'out' command step over return delay slots on SH architectures
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/cpu/sh/sh_dasm.cpp | 8 | ||||
-rw-r--r-- | src/emu/debug/debugcpu.cpp | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/src/devices/cpu/sh/sh_dasm.cpp b/src/devices/cpu/sh/sh_dasm.cpp index a2e6dd67496..5bed1b5c1c9 100644 --- a/src/devices/cpu/sh/sh_dasm.cpp +++ b/src/devices/cpu/sh/sh_dasm.cpp @@ -38,7 +38,7 @@ uint32_t sh_disassembler::op0000(std::ostream &stream, uint32_t pc, uint16_t opc break; case 0x0B: stream << "RTS"; - flags = STEP_OUT; + flags = STEP_OUT | step_over_extra(1); break; case 0x12: util::stream_format(stream, "STS GBR,%s", regname[Rn]); @@ -72,7 +72,7 @@ uint32_t sh_disassembler::op0000(std::ostream &stream, uint32_t pc, uint16_t opc break; case 0x2B: stream << "RTE"; - flags = STEP_OUT; + flags = STEP_OUT | step_over_extra(1); break; default: switch(opcode & 15) @@ -708,14 +708,14 @@ uint32_t sh_disassembler::op0000_sh34(std::ostream &stream, uint32_t pc, uint16_ { case 0x00: stream << "RTS"; - flags = STEP_OUT; + flags = STEP_OUT | step_over_extra(1); break; case 0x10: stream << "SLEEP"; break; case 0x20: stream << "RTE"; - flags = STEP_OUT; + flags = STEP_OUT | step_over_extra(1); break; } break; diff --git a/src/emu/debug/debugcpu.cpp b/src/emu/debug/debugcpu.cpp index 233e369433e..d28265d7b33 100644 --- a/src/emu/debug/debugcpu.cpp +++ b/src/emu/debug/debugcpu.cpp @@ -1607,12 +1607,20 @@ void device_debug::prepare_for_step_overout(offs_t pc) } // if we're stepping out and this isn't a step out instruction, reset the steps until stop to a high number + // (TODO: this doesn't work with conditional return instructions) if ((m_flags & DEBUG_FLAG_STEPPING_OUT) != 0) { if ((dasmresult & util::disasm_interface::SUPPORTED) != 0 && (dasmresult & util::disasm_interface::STEP_OUT) == 0) m_stepsleft = 100; else - m_stepsleft = 1; + { + // add extra instructions for delay slots + int extraskip = (dasmresult & util::disasm_interface::OVERINSTMASK) >> util::disasm_interface::OVERINSTSHIFT; + m_stepsleft = extraskip + 1; + + // take the last few steps normally + m_flags = (m_flags | DEBUG_FLAG_STEPPING) & ~DEBUG_FLAG_STEPPING_OUT; + } } } |