15 |
|
|
16 |
You should have received a copy of the GNU General Public License |
You should have received a copy of the GNU General Public License |
17 |
along with GNU Classpath; see the file COPYING. If not, write to the |
along with GNU Classpath; see the file COPYING. If not, write to the |
18 |
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA |
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
19 |
02111-1307 USA. |
02110-1301 USA. |
20 |
|
|
21 |
Linking this library statically or dynamically with other modules is |
Linking this library statically or dynamically with other modules is |
22 |
making a combined work based on this library. Thus, the terms and |
making a combined work based on this library. Thus, the terms and |
39 |
|
|
40 |
package gnu.classpath.jdwp.processor; |
package gnu.classpath.jdwp.processor; |
41 |
|
|
|
import gnu.classpath.jdwp.VMFrame; |
|
|
import gnu.classpath.jdwp.IVirtualMachine; |
|
|
import gnu.classpath.jdwp.Jdwp; |
|
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.JdwpException; |
import gnu.classpath.jdwp.exception.JdwpException; |
46 |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
import gnu.classpath.jdwp.exception.JdwpInternalErrorException; |
47 |
import gnu.classpath.jdwp.exception.NotImplementedException; |
import gnu.classpath.jdwp.exception.NotImplementedException; |
|
import gnu.classpath.jdwp.id.IdManager; |
|
48 |
import gnu.classpath.jdwp.id.ObjectId; |
import gnu.classpath.jdwp.id.ObjectId; |
49 |
import gnu.classpath.jdwp.util.Value; |
import gnu.classpath.jdwp.util.Value; |
50 |
|
|
57 |
* |
* |
58 |
* @author Aaron Luchko <aluchko@redhat.com> |
* @author Aaron Luchko <aluchko@redhat.com> |
59 |
*/ |
*/ |
60 |
public class StackFrameCommandSet implements CommandSet |
public class StackFrameCommandSet |
61 |
|
extends CommandSet |
62 |
{ |
{ |
|
// Our hook into the jvm |
|
|
private final IVirtualMachine vm = Jdwp.getIVirtualMachine(); |
|
|
|
|
|
// Manages all the different ids that are assigned by jdwp |
|
|
private final IdManager idMan = Jdwp.getIdManager(); |
|
|
|
|
63 |
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) |
public boolean runCommand(ByteBuffer bb, DataOutputStream os, byte command) |
64 |
throws JdwpException |
throws JdwpException |
65 |
{ |
{ |
97 |
private void executeGetValues(ByteBuffer bb, DataOutputStream os) |
private void executeGetValues(ByteBuffer bb, DataOutputStream os) |
98 |
throws JdwpException, IOException |
throws JdwpException, IOException |
99 |
{ |
{ |
100 |
ObjectId tId = idMan.readId(bb); |
ObjectId tId = idMan.readObjectId(bb); |
101 |
Thread thread = (Thread) tId.getObject(); |
Thread thread = (Thread) tId.getObject(); |
102 |
|
|
103 |
// Although Frames look like other ids they are not. First they are not |
// Although Frames look like other ids they are not. First they are not |
106 |
// has a reference to them. Furthermore they are not ReferenceTypeIds since |
// has a reference to them. Furthermore they are not ReferenceTypeIds since |
107 |
// these are held permanently and we want these to be held only as long as |
// these are held permanently and we want these to be held only as long as |
108 |
// the Thread is suspended. |
// the Thread is suspended. |
109 |
VMFrame frame = vm.getVMFrame(thread, bb); |
VMFrame frame = VMVirtualMachine.getFrame(thread, bb); |
110 |
int slots = bb.getInt(); |
int slots = bb.getInt(); |
111 |
os.writeInt(slots); // Looks pointless but this is the protocol |
os.writeInt(slots); // Looks pointless but this is the protocol |
112 |
for (int i = 0; i < slots; i++) |
for (int i = 0; i < slots; i++) |
121 |
private void executeSetValues(ByteBuffer bb, DataOutputStream os) |
private void executeSetValues(ByteBuffer bb, DataOutputStream os) |
122 |
throws JdwpException, IOException |
throws JdwpException, IOException |
123 |
{ |
{ |
124 |
ObjectId tId = idMan.readId(bb); |
ObjectId tId = idMan.readObjectId(bb); |
125 |
Thread thread = (Thread) tId.getObject(); |
Thread thread = (Thread) tId.getObject(); |
126 |
|
|
127 |
VMFrame frame = vm.getVMFrame(thread, bb); |
VMFrame frame = VMVirtualMachine.getFrame(thread, bb); |
128 |
|
|
129 |
int slots = bb.getInt(); |
int slots = bb.getInt(); |
130 |
for (int i = 0; i < slots; i++) |
for (int i = 0; i < slots; i++) |
138 |
private void executeThisObject(ByteBuffer bb, DataOutputStream os) |
private void executeThisObject(ByteBuffer bb, DataOutputStream os) |
139 |
throws JdwpException, IOException |
throws JdwpException, IOException |
140 |
{ |
{ |
141 |
ObjectId tId = idMan.readId(bb); |
ObjectId tId = idMan.readObjectId(bb); |
142 |
Thread thread = (Thread) tId.getObject(); |
Thread thread = (Thread) tId.getObject(); |
143 |
|
|
144 |
VMFrame frame = vm.getVMFrame(thread, bb); |
VMFrame frame = VMVirtualMachine.getFrame(thread, bb); |
145 |
|
|
146 |
Object thisObject = frame.getObject(); |
Object thisObject = frame.getObject(); |
147 |
Value.writeTaggedValue(os, thisObject); |
Value.writeTaggedValue(os, thisObject); |