[virtmach] break / watch points

Stephen Pelc sfp@mpeltd.demon.co.uk
Thu, 20 Apr 2000 10:57:00 +0100

Thad wrote:
> Who's responsibility, the VM or the debugger?
> That is, should: 
> a) the VM keep a list of break condition objects and pass 
> control to the
> debugger when one evaluates to "true", or
> b) the VM poll the debugger after every instruction, and let it do the
> checking.

If you treat the VM purely as the instruction set of a CPU, then 
you face exactly the same problems as designers of CPUs do. Some 
CPUs have a trace mode that causes an interrupt to be executed 
after each instruction. If you do this, then the interface 
between the VM and the debugger *application* is a matter of non-
destructively extracting enough CPU state information, and being 
able to restore and modify state before resuming execution.

The more you put into the VM, the more state the VM run-time has 
to check, and this will have an impact on run-time performance. 
For example, do you expect your VM to have a JIT compiler, and 
if so, how is debugging to be performed on that run-time? Are 
you going to assume that debugging will only be available in an 
interpreted environment?

These kinds of issues permeate back up a long way in your tool 

Stephen Pelc, sfp@mpeltd.demon.co.uk
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 1703 631441, fax: +44 1703 339691
web: http://www.mpeltd.demon.co.uk