lejos.nxt.debug
Class DebugInterface

java.lang.Object
  extended by lejos.nxt.debug.DebugInterface

public class DebugInterface
extends Object

This class provides the primary interface to the debug capabilities of leJOS. It has two main functions: 1. To provide access to the internal VM and program structures: Threads Stacks Methods Classes 2. Provide an event based mechanism that allows Java applications to wait for debug events from the VM.

Author:
andy

Field Summary
 int classBase
           
static int DBG_EVENT_DISABLE
           
static int DBG_EVENT_ENABLE
           
static int DBG_EVENT_IGNORE
           
static int DBG_EXCEPTION
           
static int DBG_USER_INTERRUPT
           
 Exception exception
           
 int fieldBase
           
 int frame
           
 int method
           
 int methodBase
           
 int pc
           
 DebugThread thread
           
 DebugThread[] threads
           
 int typ
           
 
Method Summary
 void clear()
           
static int eventOptions(int event, int option)
          Allow events to be enabled/disabled/ignored.
static void executeProgram(int progNo)
          leJOS allows several "programs" to be linked into a single nxj file the system by default will start excution of program 0.
static DebugInterface get()
           
protected static int getAddress(Object obj)
          Return the actual VM address of an object.
protected static int peekWord(int addr)
          Allow access to VM data structures
protected static int peekWord(Object obj, int offset)
          Allow access to VM data structures
 int waitEvent(int millis)
          Wait for a debug event from the kernel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DBG_EXCEPTION

public static final int DBG_EXCEPTION
See Also:
Constant Field Values

DBG_USER_INTERRUPT

public static final int DBG_USER_INTERRUPT
See Also:
Constant Field Values

DBG_EVENT_DISABLE

public static final int DBG_EVENT_DISABLE
See Also:
Constant Field Values

DBG_EVENT_ENABLE

public static final int DBG_EVENT_ENABLE
See Also:
Constant Field Values

DBG_EVENT_IGNORE

public static final int DBG_EVENT_IGNORE
See Also:
Constant Field Values

typ

public int typ

exception

public Exception exception

thread

public DebugThread thread

pc

public int pc

frame

public int frame

method

public int method

methodBase

public int methodBase

classBase

public int classBase

fieldBase

public int fieldBase

threads

public DebugThread[] threads
Method Detail

get

public static DebugInterface get()

clear

public void clear()

waitEvent

public final int waitEvent(int millis)
                    throws InterruptedException
Wait for a debug event from the kernel

Parameters:
millis - wait for at most millis milliseconds. 0 = forever.
Returns:
The new debug event
Throws:
InterruptedException

peekWord

protected static final int peekWord(int addr)
Allow access to VM data structures

Parameters:
addr - the address in the VM memory of a word
Returns:
the value of the word at addr

peekWord

protected static final int peekWord(Object obj,
                                    int offset)
Allow access to VM data structures

Parameters:
obj - the object to peek into
offset - the address in the VM memory of a word
Returns:
the value of the word at addr

getAddress

protected static final int getAddress(Object obj)
Return the actual VM address of an object.

Parameters:
obj -
Returns:
the address of the object

eventOptions

public static final int eventOptions(int event,
                                     int option)
Allow events to be enabled/disabled/ignored. Disabled events will return to the default behaviour. Enabled events will be reported via this interface. Ignored events will be discarded.

Parameters:
event -
option -
Returns:
previous state of this event.

executeProgram

public static void executeProgram(int progNo)
leJOS allows several "programs" to be linked into a single nxj file the system by default will start excution of program 0. This function allows other programs to be called.

Parameters:
progNo - program number to call