Contents Previous Next

Chapter   7

ThreadReference Command Set


This command set is numbered (11) to match the equivalent JDWP command set.

 Name Command (1)

Returns the thread name.

Out Data
TABLE 17  –  Structure of Out Data for Name Command
threadID
threadObject
The thread object ID.  

Reply Data
TABLE 18  –  Structure of Reply Data for Name Command
string
threadName
The thread name. 

 Suspend Command (2)

Suspends the thread.

Unlike java.lang.Thread.suspend(), suspends of both the virtual machine and individual threads are counted. Before a thread can run again, it must be resumed the same number of times it has been suspended.

Suspending single threads with this command has the same dangers as is the case with method java.lang.Thread.suspend(). If the suspended thread holds a monitor needed by another running thread, deadlock is possible in the target VM (at least until the suspended thread is resumed again).

The suspended thread is guaranteed to remain suspended until resumed through one of the JDI resume methods mentioned above.

Note that this doesn't change the status of the thread (see the ThreadStatus command.) For example, if it was Running, it still appears to other threads to be running.

Out Data
TABLE 19  –  Structure of Out Data for Suspend Command
threadID
threadObject
The thread object ID.  

Reply Data

(None)

 Resume Command (3)

Resumes the execution of a given thread. If this thread was not previously suspended by the front-end, calling this command has no effect. Otherwise, the count of pending suspends on this thread is decremented. If it is decremented to 0, the thread continues to execute.

Out Data
TABLE 20  –  Structure of Out Data for Resume Command
threadID
threadObject
The thread object ID.  

Reply Data

(None)

 Status Command (4)

Returns the current status of a thread. The thread status reply indicates the thread status the last time it was running. The suspend status provides information on the thread's suspension, if any.

Out Data
TABLE 21  –  Structure of Out Data for Status Command
threadID
threadObject
The thread object ID.  

Reply Data
TABLE 22  –  Structure of Reply Data for Status Command
int
threadStatus
One of the thread status codes. See KDWP.ThreadStatus 
int
suspendStatus
One of the suspend status codes. See KDWP.SuspendStatus 

 Frames Command (6)

Returns the current call stack of a suspended thread. The sequence of frames starts with the currently executing frame, followed by its caller, and so on. The thread must be suspended, and the returned frameID is valid only while the thread is suspended.

Out Data
TABLE 23  –  Structure of Out Data for Frames Command
threadID
threadObject
The thread object ID.  
int
startFrame
The index of the first frame to retrieve. 
int
length
The count of frames to retrieve (-1 means all remaining).

Reply Data
TABLE 24  –  Structure of Reply Data for Frames Command
int
frames
number of frames retrieved 
Repeated frames times:
frameID
frameID
The ID of this frame.  
location
location
The current location of this frame 

 FrameCount Command (7)

Returns the count of frames on this thread's stack. The thread must be suspended, and the returned count is valid only while the thread is suspended.

Out Data
TABLE 25  –  Structure of Out Data for FrameCount Command
threadID
threadObject
The thread object ID.  

Reply Data
TABLE 26  –  Structure of Reply Data for FrameCount Command
int
frameCount
The count of frames on this thread's stack.  

 Stop Command (10)

Stops the thread with an asynchronous exception, as if done by java.lang.Thread.stop.

Out Data
TABLE 27  –  Structure of Out Data for Stop Command
threadID
threadObject
The thread object ID.  
objectID
throwable
Asynchronous exception. This object must be an instance of java.lang.Throwable or a subclass 

Reply Data

(None)

 SuspendCount Command (12)

Get the suspend count for this thread. The suspend count is the number of times the thread has been suspended through the thread-level or VM-level suspend commands without a corresponding resume.

Out Data
TABLE 28  –  Structure of Out Data for SuspendCount Command
threadID
threadObject
The thread object ID.  

Reply Data
TABLE 29  –  Structure of Reply Data for SuspendCount Command
int
suspendCount
The number of outstanding suspends of this thread.  

 


Contents Previous Next KDWP Specification
KVM Debug Wire Protocol, 1.0