Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breakpoints #1

Open
maximumspatium opened this issue Oct 1, 2020 · 0 comments
Open

Breakpoints #1

maximumspatium opened this issue Oct 1, 2020 · 0 comments

Comments

@maximumspatium
Copy link

Thank you very much for bringing us this amazing library!

I'm trying to create an interactive debugger for exploring legacy 68k code based on bare68k.
While implementing breakpoints based on the built-in tools, I noticed that the code execution always stops at the next instruction AFTER the breakpoint location:

0x21a84	  *	LINK.W	A6, #$0
0x21a88	  X	MOVE.L	A3, -(A7)
0x21a8a		MOVEA.L	$8(A6), A3
0x21a8e		BSET.B	#$7, $C2C.W
0x21a94		CLR.L	(A3)

In the above code, the asterisk indicates the breakpoint location and "X" is the location where the execution actually halts.
I'm using the following code:

tools.set_breakpoint(0, addr, MEM_FC_SUPER_MASK, "BKPT1")
rt.run()
tools.disable_breakpoint(0)

When I set addr to 0x21a84, the execution actually stops at 0x21a88 as confirmed by the following log message:

2020-10-01 12:35:26,535          bare68k.handler:   INFO:  BREAKPOINT: @00021a84 #0 flags=SD data=BKPT1

PC=00021a88  SR=--S--210-----Z--
D0=00020400  D1=00000001  D2=00000000  D3=00000000
D4=00000000  D5=00000000  D6=00000000  D7=00000000
A0=00020404  A1=000239b2  A2=00000000  A3=00000000
A4=00020000  A5=00000000  A6=00000790  A7=00000790
USP=00000000 ISP=00000790 MSP=00000000 VBR=00000000

I'd like to make my debugger to behave just like GDB - the execution should halt at the specified location before executing the marked instruction.

What do I need to change to make it work?
Thank you in advance!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant