Re: [hatari-devel] Hatari debugger questions

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Le 26/02/2018 à 11:46, Nicolas Pomarède a écrit :

Further, when I change the pc value and then enter 's' my expectation is
that the first command at the new pc location is executed. What happens
instead is that the instruction at the previous (old) pc location is
executed.

Am I doing something wrong? What do I have to do in order to change the
pc value and then to single-step starting at the new pc location?


I will write a small asm test code to check if I can reproduce this.


It seems to work for me. Consider this small example :

        moveq   #0,d0
        moveq   #0,d1
        moveq   #0,d2

        moveq   #1,d1
        moveq   #2,d2
        moveq   #3,d3

        nop

attached is the resulting .prg.

Now, run hatari and press alt+pause to enter debugger when gem desktop appears for example.

Load the program at address $40000 for a quick test :

loadbin debug.prg $40000

set 2 breakpoints at $40022 and $40028 and set pc=$4001c :

a $40022
a $40028
r pc=$4001c

This is the code in RAM :

$0004001c : 7000                               moveq     #0,d0
$0004001e : 7200                               moveq     #0,d1
$00040020 : 7400                               moveq     #0,d2
$00040022 : 7201                               moveq     #1,d1
$00040024 : 7402                               moveq     #2,d2
$00040026 : 7603                               moveq     #3,d3
$00040028 : 4e71                               nop

Type 'r', you can see that d0/d1/d2/d3 have various non null values

Now type 'c', program will run from $4001e until breakpoint at $40022 -> -> d0/d1/d2 are correctly set to '0'

Skip instr at $40022 by changing PC
> r pc=$40024

type 's' to continue and execute only 1 instruction and type 'r' after.

> s

CPU=$40026, VBL=2862, FrameCycles=2480, HBL=4, LineCycles=432, DSP=N/A
$00040026 : 7603                               moveq     #3,d3
> r
  D0 00000000   D1 00000000   D2 00000002   D3 00000000

So, only D2 was changed (by instruction at PC=40024) and program goes back to debugger correctly with PC=$40026.
-> The 1st instruction at the new PC was correctly executed.

Can you try this ? I checked with 68000 cpu, do you use 68030 ?

This requires hatari 2.1, as 2.0 could have prefetch issue when changing PC.


Nicolas





Attachment: debug.prg
Description: Binary data

	moveq	#0,d0
	moveq	#0,d1
	moveq	#0,d2

	moveq	#1,d1
	moveq	#2,d2
	moveq	#3,d3

	nop



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/