Re: [hatari-devel] debugger help |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/hatari-devel Archives
]
Hi,
On tiistai 11 helmikuu 2014, Douglas Little wrote:
> If "next" should behave like "next" in other debuggers, it would
>
> > need to know what the current instruction will do, and depending
> > on that, either set breakpoint like now, or step one instruction.
> >
> > Question is, what kind of instructions would require breakpoint
> > instead of stepping: BSR, JSR, BKPT, ILLG, STOP, TRAP...?
>
> I agree this is probably difficult/complicated to implement in terms of
> predicting a breakpoint address. It's probably more comfortable as a hook
> in the emulation stepper itself, which informs the debugger of each new
> PC visited and provides an opportunity to break. Something like that
> which doesn't require the debugger to understand a lot of detail on what
> happened - shoves the work onto the emulator.
>
> I don't know if that is something that fits well with Hatari and/or the
> existing cores - or what other side effects this would have on
> performance, if it could even be made optional etc. so that's another
> matter entirely...
Does the attached patch do what you were after?
(*_OpcodeType() functions have some deficiencies in them, but
those can be improved separately.)
- Eero
diff -r 20f6b4914ce0 src/debug/debugcpu.c
--- a/src/debug/debugcpu.c Tue Feb 11 12:01:49 2014 +0200
+++ b/src/debug/debugcpu.c Wed Feb 12 23:00:52 2014 +0200
@@ -532,12 +532,23 @@
}
else
{
- Uint32 nextpc = Disasm_GetNextPC(M68000_GetPC());
+ Uint32 optype, nextpc;
+
+ optype = DebugCpu_OpcodeType();
+ /* can this instruction be stepped normally? */
+ if (optype != CALL_SUBROUTINE && optype != CALL_EXCEPTION)
+ {
+ nCpuSteps = 1;
+ return DEBUGGER_END;
+ }
+
+ nextpc = Disasm_GetNextPC(M68000_GetPC());
sprintf(command, "pc=$%x :once :quiet\n", nextpc);
}
+ /* use breakpoint, not steps */
if (BreakCond_Command(command, false))
{
- nCpuSteps = 0; /* using breakpoint, not steps */
+ nCpuSteps = 0;
return DEBUGGER_END;
}
return DEBUGGER_CMDDONE;
diff -r 20f6b4914ce0 src/debug/debugdsp.c
--- a/src/debug/debugdsp.c Tue Feb 11 12:01:49 2014 +0200
+++ b/src/debug/debugdsp.c Wed Feb 12 23:00:52 2014 +0200
@@ -345,11 +345,23 @@
}
else
{
- Uint16 nextpc = DSP_GetNextPC(DSP_GetPC());
+ Uint32 optype;
+ Uint16 nextpc;
+
+ optype = DebugDsp_OpcodeType();
+ /* can this instruction be stepped normally? */
+ if (optype != CALL_SUBROUTINE && optype != CALL_EXCEPTION)
+ {
+ nDspSteps = 1;
+ return DEBUGGER_END;
+ }
+
+ nextpc = DSP_GetNextPC(DSP_GetPC());
sprintf(command, "pc=$%x :once :quiet\n", nextpc);
}
+ /* use breakpoint, not steps */
if (BreakCond_Command(command, true)) {
- nDspSteps = 0; /* using breakpoint, not steps */
+ nDspSteps = 0;
return DEBUGGER_END;
}
return DEBUGGER_CMDDONE;