Package com.sun.jdi

Examples of com.sun.jdi.VirtualMachine


 
  public static String setFieldValue(String name, String exp) {
    ThreadReference threadRef = checkAndGetCurrentThread();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    Debugger debugger = Debugger.getInstance();
    VirtualMachine vm = debugger.getVm();
   
    try {
     
      ParseResult result = AstTreeFactory.getExpressionAst(exp);
      if (result.hasError()) {
        return result.getErrorMsg();
      }
      Object obj = evalTreeNode(result.getTree());
      Value value = null;
      if (obj instanceof Integer) {
        value = vm.mirrorOf(((Integer)obj).intValue());
      } else if (obj instanceof Boolean) {
        value = vm.mirrorOf(((Boolean)obj).booleanValue());
      } else if (obj instanceof String) {
        value = vm.mirrorOf((String)obj);
      } else {
        value = (Value)obj;
      }
     
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
View Full Code Here


    if (var instanceof ObjectReference || var instanceof ReferenceType) {
      return invoke(var,methodName,arguments);
    }
    if (var instanceof String) {
      Debugger debugger = Debugger.getInstance();
      VirtualMachine vm = debugger.getVm();
      return invoke(vm.mirrorOf((String)var),methodName,arguments);
    }
    return null;
  }
View Full Code Here

  private static Value getMirrorValue(Object value) {
    if (value == null) return null;
    if (value instanceof Value) return (Value)value;
   
    Debugger debugger = Debugger.getInstance();
    VirtualMachine vm = debugger.getVm();
    if (value instanceof Integer) {
      return vm.mirrorOf(((Integer)value).intValue());
    } else if (value instanceof Boolean) {
      return vm.mirrorOf(((Boolean)value).booleanValue());
    } else if (value instanceof Float) {
      return vm.mirrorOf(((Float)value).floatValue());
    } else if (value instanceof Byte) {
      return vm.mirrorOf(((Byte)value).byteValue());
    } else if (value instanceof Character) {
      return vm.mirrorOf(((Character)value).charValue());
    } else if (value instanceof Double) {
      return vm.mirrorOf(((Double)value).doubleValue());
    } else if (value instanceof Long) {
      return vm.mirrorOf(((Long)value).longValue());
    } else if (value instanceof Short) {
      return vm.mirrorOf(((Short)value).shortValue());
    } else if (value instanceof String) {
      return vm.mirrorOf(((String)value));
    }
    return null;
  }
View Full Code Here

            try {
                secondsToWait = Integer.parseInt(System.getProperty(CONNECTION_WAIT_PROPERTY, "0"));
            } catch (NumberFormatException nfe) {
                ;
            }
            VirtualMachine vm = ClassLoaderPatcher.hotswapClassLoader(
                clp,
                starter.getTransport(),
                starter.getAddress(),
                secondsToWait);
            if (vm == null) {
                process.destroy();
            } else {
                vm.resume();
                vm.dispose();
            }
        }

        // attach VM other streams to this streams
        redirectOtherStreams();
View Full Code Here

  private static JdeLogger log = JdeLogger.getLogger("HotSwapServer");

  @SuppressWarnings("unchecked")
  public static void replace(Debugger debugger, File classFile, String className) {
   
    VirtualMachine vm = debugger.getVm();
    if (vm == null) return;
    if (!vm.canRedefineClasses()) return;
   
    byte[] classBytes = loadClassFile(classFile);
    if (classBytes == null ) return;
   
    List classes = vm.classesByName(className);

    if (classes == null || classes.size() == 0)
      return;

    for (int i = 0; i < classes.size(); i++) {
      ReferenceType refType = (ReferenceType) classes.get(i);
      HashMap map = new HashMap();
      map.put(refType, classBytes);
      vm.redefineClasses(map);
    }
  }
View Full Code Here

                        }
                        if (ex instanceof IOException) {
                            throw (IOException)ex;
                        }

                        VirtualMachine vm= runnable.getVirtualMachine();
                        if (vm != null) {
                            DroolsDebugModel.newDebugTarget(launch, vm, renderDebugTarget(config.getClassToLaunch(), port), process, true, false, config.isResumeOnStartup());
                            subMonitor.worked(1);
                            subMonitor.done();
                        }
View Full Code Here

            return;
        }
        try {
            setSuspended( false );
            resumeThreads();
            VirtualMachine vm = getVM();
            if ( vm != null ) {
                vm.resume();
            }
            if ( fireNotification ) {
                fireResumeEvent( DebugEvent.CLIENT_REQUEST );
            }
        } catch ( VMDisconnectedException e ) {
View Full Code Here

            notSupported( JDIDebugModelMessages.JDIDebugTarget_does_not_support_disconnect );
        }

        try {
            disposeThreadHandler();
            VirtualMachine vm = getVM();
            if ( vm != null ) {
                vm.dispose();
            }
        } catch ( VMDisconnectedException e ) {
            // if the VM disconnects while disconnecting, perform
            // normal disconnect handling
            disconnected();
View Full Code Here

            notSupported( JDIDebugModelMessages.JDIDebugTarget_does_not_support_termination );
        }
        try {
            setTerminating( true );
            disposeThreadHandler();
            VirtualMachine vm = getVM();
            if ( vm != null ) {
                vm.exit( 1 );
            }
            IProcess process = getProcess();
            if ( process != null ) {
                process.terminate();
            }
View Full Code Here

    }

    protected void initializeState() {

        List threads = null;
        VirtualMachine vm = getVM();
        if ( vm != null ) {
            try {
                threads = vm.allThreads();
            } catch ( RuntimeException e ) {
                internalError( e );
            }
            if ( threads != null ) {
                Iterator initialThreads = threads.iterator();
View Full Code Here

TOP

Related Classes of com.sun.jdi.VirtualMachine

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.