[comp.sys.atari.st] Help needed in writting my debugger

bds@lzaz.ATT.COM (Bruce Szablak) (01/19/90)

I'm attempting to port my Minix debugger to TOS, and I'm having a difficulty
that perhaps some TOS guru can quickly identify for me. Consider the
following pseudo-code fragment (taken from memory):

	Pexec(LOAD-DON'T-GO,...)
	move user stack to static buffer
	Pexec(GO,...)
	Cconws("Program terminated.")
	...

This code works fine: program starts up, proceeds until requested to exit.
Now consider the following:

	Pexec(LOAD-DON'T-GO,...)
	save registers and insert breakpoint at start of loaded program
	move user stack to static buffer
	Pexec(GO,...)
	Cconws("Program terminated.")
	...
break entrypoint :
	Save registers and restore debugger's registers
	...
return to process entry point:
	Save registers and restore process's registers
	RTE

(I've ommitted obvious details like setting up vectors etc. I'm using
a trap #0 instruction for the breakpoint.)
The above code works great (breakpoint hit, additional breakpoints can
be set, process can be single stepped, etc.) but when I "continue" the
child process the system locks up at the point that the child should exit:
i.e. in Pterm() (and no "Program terminated" message is seen).
Since I'm using a local stack arena to do the Pexec (which shouldn't
get trashed), and the process executes just fine after returning from the
debugger, I don't understand the lock up at all. The test program can be
as simple as:
	main() { Pterm0(); }
I've also tried calling a C function that in turn did the Pexec
(to make sure the base register was set up correctly).  Any suggestions?