/** * Clears all the requests for a given event * * @param kind the event kind * @throws IllegalArgumentException for invalid event kind * @throws JdwpException for error clearing events */ public void clearRequests(byte kind) throws JdwpException { Hashtable requests = (Hashtable) _requests.get(new Byte(kind)); if (requests == null) { // Did not get a valid event type throw new IllegalArgumentException("invalid event kind: " + kind); } VMVirtualMachine.clearEvents(kind); requests.clear(); }
/** * Requests monitoring of an event. * * <p>The debugger registers for event notification through an event filter. If no event filter is * specified for an event in the VM, it is assumed that the debugger is not interested in * receiving notifications of this event. * * <p>The virtual machine will be notified of the request. * * @param request the request to monitor * @throws InvalidEventTypeException for invalid event kind * @throws JdwpException for other errors involving request */ public void requestEvent(EventRequest request) throws JdwpException { // Add request to request list Hashtable requests; Byte kind = new Byte(request.getEventKind()); requests = (Hashtable) _requests.get(kind); if (requests == null) { // Did not get a valid event type throw new InvalidEventTypeException(request.getEventKind()); } // Register the event with the VM VMVirtualMachine.registerEvent(request); requests.put(new Integer(request.getId()), request); }
private void executeByteCodes(ByteBuffer bb, DataOutputStream os) throws JdwpException, IOException { if (!VMVirtualMachine.canGetBytecodes) { String msg = "getting bytecodes is unsupported"; throw new NotImplementedException(msg); } ReferenceTypeId id = idMan.readReferenceTypeId(bb); Class<?> klass = id.getType(); VMMethod method = VMMethod.readId(klass, bb); byte[] bytecode = VMVirtualMachine.getBytecodes(method); os.writeInt(bytecode.length); os.write(bytecode); }
/** * Deletes the given request from the management table * * @param kind the event kind * @param id the ID of the request to delete * @throws IllegalArgumentException for invalid event kind * @throws JdwpException for other errors deleting request */ public void deleteRequest(byte kind, int id) throws JdwpException { Hashtable requests; requests = (Hashtable) _requests.get(new Byte(kind)); if (requests == null) { // Did not get a valid event type throw new IllegalArgumentException("invalid event kind: " + kind); } Integer iid = new Integer(id); EventRequest request = (EventRequest) requests.get(iid); if (request != null) { VMVirtualMachine.unregisterEvent(request); requests.remove(iid); } }