[hatari-devel] Execution history debugger command

Eero Tamminen eerot at users.berlios.de
Sun Aug 14 12:33:21 CEST 2011


Hi,

On perjantai 10 kesäkuu 2011, Eero Tamminen wrote:
> I decided that the history thing should:
> 
> * Store only PC for DSP & CPU, but for everything,
>   not just breakpoint
> 
> * When being asked for history, show disassembly of
>   instructions on these PC addresses
> 
> 
> This can be utilized in breakpoints by automatically showing
> the instructions leading to the breakpoint being hit, with
> something like this:
>   history on
> 	lock history 8
> 	b <some condition>  :lock
> 
> This would, whenever given condition is hit, show the "locked"
> information i.e. history of requested last 8 instructions and
> then continue.

I commited this now.  History shows both PC and DSP instructions.


> I can make it so that PC values/instructions that were shown by
> previous breakpoint aren't repeated if breakpoint happens to hit more
> often than at 8 instructions interval.
> 
> You can also ask more history in debugger and it will mark in
> the output the places where breakpoints (or other debugger
> entries) happened.

The output looks like this on ST:
---------------------------------
You have entered debug mode. Type c to continue emulation, h for help.

CPU=$1a0c2, VBL=140, FrameCycles=72, HBL=0, LineCycles=72, DSP=N/A
> history on
> lock history 8
Locked history output.
> c 200
Returning to emulation for 200 CPU instructions...
$01a0c6 : 6604                                 bne.s     $1a0cc
$01a0c8 : 7604                                 moveq     #4,d3
$01a0ca : 600c                                 bra.s     $1a0d8
$01a0d8 : 5882                                 addq.l    #4,d2
$01a0da : d4c3                                 adda.w    d3,a2
$01a0dc : 60dc                                 bra.s     $1a0ba
$01a0ba : b481                                 cmp.l     d1,d2
$01a0bc : 6720                                 beq.s     $1a0de
Debugger: *CPU steps*
> c
Returning to emulation...
OS clock ticks / second: 100
Your system is too slow, some sound samples were not correctly emulated
SPEED: 1209.0 VBL/s (1753/1.4s), diff=0.0%
$084a42 : 2441                                 movea.l   d1,a2
$084a44 : 3012                                 move.w    (a2),d0
$084a46 : d15b                                 add.w     d0,(a3)+
$084a48 : 1228 00ee                            move.b    $ee(a0),d1
$084a4c : 2441                                 movea.l   d1,a2
$084a4e : 3012                                 move.w    (a2),d0
$084a50 : d15b                                 add.w     d0,(a3)+
$084a52 : 1228 00f0                            move.b    $f0(a0),d1
Debugger: *User break*
> info default

CPU=$84a56, VBL=1754, FrameCycles=64, HBL=0, LineCycles=64, DSP=N/A
--------------------------

If you "lock" the output on entering debugger to a debugger script,
you can in that script get whatever information you want in addition
to the amount of history you specified.


If you run it on Falcon with DSP enabled, you see also DSP
instructions:
--------------------------
> lock history 10
Locked history output.
> c 2
Returning to emulation for 2 CPU instructions...
p:0051  0c0051         (04 cyc)  jmp p:$0051
p:0051  0c0051         (04 cyc)  jmp p:$0051
Debugger: *CPU steps*
$e07cde : 51c8 fffc                            dbra      d0,$e07cdc
p:0051  0c0051         (04 cyc)  jmp p:$0051
p:0051  0c0051         (04 cyc)  jmp p:$0051
p:0051  0c0051         (04 cyc)  jmp p:$0051
$e07cdc : 20c2                                 move.l    d2,(a0)+
p:0051  0c0051         (04 cyc)  jmp p:$0051
p:0051  0c0051         (04 cyc)  jmp p:$0051
p:0051  0c0051         (04 cyc)  jmp p:$0051
Debugger: *CPU steps*
--------------------------

The first "Debugger" line in above output indcates where I gave the "c 2"
command to continue for 2 CPU instructions, after my previous stepping
debugger invocation had finished.


> This will give with couple of extra code lines variables for
> previous DSP & CPU PC variable values which can be used e.g. to
> find out jumps to some location that aren't loop jumps:
> 	b  pc = <entry address>  &&  PrevPcCpu ! <loop jump address>


	- Eero



More information about the hatari-devel mailing list