One embodiment of the present invention provides a system that facilitates debugging
a platform-independent virtual machine. The system operates by providing an agent
on the platform-independent virtual machine, which provides a set of functions
for accessing variables in the platform-independent virtual machine. The platform-independent
virtual machine is adapted to call the set of functions within the agent. Next,
the agent examines the current state of the variables in the platform-independent
virtual machine. The agent communicates the current state of the variables to a
host machine. An operator of the host machine can then analyze the current state
of the variables.