39 |
|
|
40 |
package gnu.classpath.jdwp.processor; |
package gnu.classpath.jdwp.processor; |
41 |
|
|
|
import gnu.classpath.jdwp.VMFrame; |
|
42 |
import gnu.classpath.jdwp.JdwpConstants; |
import gnu.classpath.jdwp.JdwpConstants; |
43 |
|
import gnu.classpath.jdwp.VMFrame; |
44 |
|
import gnu.classpath.jdwp.VMVirtualMachine; |
45 |
import gnu.classpath.jdwp.exception.InvalidObjectException; |
import gnu.classpath.jdwp.exception.InvalidObjectException; |
46 |
import gnu.classpath.jdwp.exception.JdwpException; |
import gnu.classpath.jdwp.exception.JdwpException; |
47 |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
125 |
throws JdwpException, IOException |
throws JdwpException, IOException |
126 |
{ |
{ |
127 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
128 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
129 |
JdwpString.writeString(os, thread.getName()); |
JdwpString.writeString(os, thread.getName()); |
130 |
} |
} |
131 |
|
|
133 |
throws JdwpException, IOException |
throws JdwpException, IOException |
134 |
{ |
{ |
135 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
136 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
137 |
vm.suspendThread(thread); |
VMVirtualMachine.suspendThread(thread); |
138 |
} |
} |
139 |
|
|
140 |
private void executeResume(ByteBuffer bb, DataOutputStream os) |
private void executeResume(ByteBuffer bb, DataOutputStream os) |
141 |
throws JdwpException, IOException |
throws JdwpException, IOException |
142 |
{ |
{ |
143 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
144 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
145 |
vm.suspendThread(thread); |
VMVirtualMachine.suspendThread(thread); |
146 |
} |
} |
147 |
|
|
148 |
private void executeStatus(ByteBuffer bb, DataOutputStream os) |
private void executeStatus(ByteBuffer bb, DataOutputStream os) |
149 |
throws InvalidObjectException, IOException |
throws JdwpException, IOException |
150 |
{ |
{ |
151 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
152 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
153 |
int threadStatus = vm.getThreadStatus(thread); |
int threadStatus = VMVirtualMachine.getThreadStatus(thread); |
154 |
// There's only one possible SuspendStatus... |
// There's only one possible SuspendStatus... |
155 |
int suspendStatus = JdwpConstants.SuspendStatus.SUSPENDED; |
int suspendStatus = JdwpConstants.SuspendStatus.SUSPENDED; |
156 |
|
|
159 |
} |
} |
160 |
|
|
161 |
private void executeThreadGroup(ByteBuffer bb, DataOutputStream os) |
private void executeThreadGroup(ByteBuffer bb, DataOutputStream os) |
162 |
throws InvalidObjectException, IOException |
throws JdwpException, IOException |
163 |
{ |
{ |
164 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
165 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
166 |
ThreadGroup group = thread.getThreadGroup(); |
ThreadGroup group = thread.getThreadGroup(); |
167 |
ObjectId groupId = idMan.getObjectId(group); |
ObjectId groupId = idMan.getObjectId(group); |
168 |
groupId.write(os); |
groupId.write(os); |
172 |
throws JdwpException, IOException |
throws JdwpException, IOException |
173 |
{ |
{ |
174 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
175 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
176 |
int startFrame = bb.getInt(); |
int startFrame = bb.getInt(); |
177 |
int length = bb.getInt(); |
int length = bb.getInt(); |
178 |
|
|
179 |
ArrayList frames = vm.getVMFrames(thread, startFrame, length); |
ArrayList frames = VMVirtualMachine.getFrames(thread, startFrame, length); |
180 |
os.writeInt(frames.size()); |
os.writeInt(frames.size()); |
181 |
for (int i = 0; i < frames.size(); i++) |
for (int i = 0; i < frames.size(); i++) |
182 |
{ |
{ |
191 |
throws JdwpException, IOException |
throws JdwpException, IOException |
192 |
{ |
{ |
193 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
194 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
195 |
|
|
196 |
int frameCount = vm.getFrameCount(thread); |
int frameCount = VMVirtualMachine.getFrameCount(thread); |
197 |
os.writeInt(frameCount); |
os.writeInt(frameCount); |
198 |
} |
} |
199 |
|
|
220 |
throws JdwpException, IOException |
throws JdwpException, IOException |
221 |
{ |
{ |
222 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
223 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
224 |
ObjectId exception = idMan.readObjectId(bb); |
ObjectId exception = idMan.readObjectId(bb); |
225 |
vm.stopThread(thread, (Exception) exception.getObject()); |
Throwable throwable = (Throwable) exception.getObject(); |
226 |
|
thread.stop (throwable); |
227 |
} |
} |
228 |
|
|
229 |
private void executeInterrupt(ByteBuffer bb, DataOutputStream os) |
private void executeInterrupt(ByteBuffer bb, DataOutputStream os) |
230 |
throws JdwpException, IOException |
throws JdwpException, IOException |
231 |
{ |
{ |
232 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
233 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
234 |
thread.interrupt(); |
thread.interrupt(); |
235 |
} |
} |
236 |
|
|
238 |
throws JdwpException, IOException |
throws JdwpException, IOException |
239 |
{ |
{ |
240 |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
ThreadId tid = (ThreadId) idMan.readObjectId(bb); |
241 |
Thread thread = (Thread) tid.getObject(); |
Thread thread = tid.getThread(); |
242 |
int suspendCount = vm.getSuspendCount(thread); |
int suspendCount = VMVirtualMachine.getSuspendCount(thread); |
243 |
os.writeInt(suspendCount); |
os.writeInt(suspendCount); |
244 |
} |
} |
245 |
} |
} |