Examples of ThreadReference


Examples of com.sun.jdi.ThreadReference

    }
  }
 
  public String listFrames() {
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ThreadReference threadRef = threadStack.getCurThreadRef();
    StringBuilder sb = new StringBuilder();
    appendStackInfo(sb,threadRef,0);
    return sb.toString();
  }
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    return sb.toString();
  }

  public String resume() {
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ThreadReference threadRef = threadStack.getCurThreadRef();
    threadRef.resume();
    threadStack.clean();
    return "";
  }
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    return "";
  }
 
  public String changeCurrentThread(String uniqueId) {
    List<ThreadReference> threads = vm.allThreads();
    ThreadReference correctRef = null;
    for (ThreadReference ref : threads) {
      if (String.valueOf(ref.uniqueID()).equals(uniqueId)) {
        correctRef = ref;
        break;
      }
    }
    if (correctRef == null) return "no suspend thread";
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ReferenceType refType;
    try {
      Location loc = correctRef.frame(0).location();
      refType = loc.declaringType();
      threadStack.setCurRefType(refType);
      threadStack.setCurThreadRef(correctRef);
      changeVimEditSourceLocaton(loc);
      return "success";
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    }
  }
 
  public String changeCurrentFrame(int frameNum) {
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ThreadReference threadRef = threadStack.getCurThreadRef();
    if (threadRef == null ) {
      return "no suspended thread";
    }
    try {
      Location loc = threadRef.frame(frameNum).location();
      ReferenceType refType= loc.declaringType();
      threadStack.setCurRefType(refType);
      threadStack.setCurFrame(frameNum);
      changeVimEditSourceLocaton(loc);
      return "success";
View Full Code Here

Examples of com.sun.jdi.ThreadReference

  public static String step(int stepDepth) {
    Debugger debugger = Debugger.getInstance();
    VirtualMachine vm = debugger.getVm();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    ThreadReference threadRef = threadStack.getCurThreadRef();

    EventRequestManager mgr = vm.eventRequestManager();

    List<StepRequest> steps = mgr.stepRequests();
    for (int i = 0; i < steps.size(); i++) {
      StepRequest step = steps.get(i);
      if (step.thread().equals(threadRef)) {
        mgr.deleteEventRequest(step);
        break;
      }
    }

    StepRequest request = mgr.createStepRequest(threadRef, StepRequest.STEP_LINE, stepDepth);
    List<String> excludeFilters = StepFilterConfiger.getDefaultFilter();
    for (String filter : excludeFilters) {
      request.addClassExclusionFilter(filter);
    }
    request.addCountFilter(1);
    request.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
    request.enable();
   
    threadRef.resume();
    threadStack.clean();
    return "";
  }
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    System.out.println(result.getTree());
   
  }
 
  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());
      LocalVariable localVariable;
      localVariable = stackFrame.visibleVariableByName(name);
      if (localVariable != null) {
        stackFrame.setValue(localVariable, value);
      } else {
View Full Code Here

Examples of com.sun.jdi.ThreadReference

      return e.getMessage();
    }
  }
 
  public static String fields() {
    ThreadReference threadRef = checkAndGetCurrentThread();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    StringBuilder sb = new StringBuilder();
    try {
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      ObjectReference thisObj = stackFrame.thisObject();
      Map<Field, Value> values = thisObj.getValues(thisObj.referenceType().visibleFields());
      List<String> fieldNames = new ArrayList<String>();
      for (Field field : values.keySet()) {
        fieldNames.add(field.name());
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    return sb.toString();
  }

 
  public static String variables() {
    ThreadReference threadRef = checkAndGetCurrentThread();
    SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
    int curFrame = threadStack.getCurFrame();
    StringBuilder sb = new StringBuilder();
    try {
      List<String> varNames = new ArrayList<String>();
      for (LocalVariable var : threadRef.frame(curFrame).visibleVariables()) {
        varNames.add(var.name());
      }
      int maxLen = getMaxLength(varNames)+2;
      for (LocalVariable var : threadRef.frame(curFrame).visibleVariables()) {
        Value value = threadRef.frame(curFrame).getValue(var);
        sb.append(padStr(maxLen,var.name())).append(":");
        sb.append(getPrettyPrintStr(value));
        sb.append("\n");
      }
    } catch (AbsentInformationException e) {
View Full Code Here

Examples of com.sun.jdi.ThreadReference

    }
    return null;
  }
 
  private static Value evalJdiVar(String name) {
    ThreadReference threadRef = checkAndGetCurrentThread();
    try {
      SuspendThreadStack threadStack = SuspendThreadStack.getInstance();
      StackFrame stackFrame = threadRef.frame(threadStack.getCurFrame());
      ObjectReference thisObj = stackFrame.thisObject();
      Value value = findValueInFrame(threadRef, name, thisObj);
      return value;
    } catch (IncompatibleThreadStateException e) {
      throw new ExpressionEvalException("eval expression error, caused by : " + e.getMessage());
View Full Code Here

Examples of com.sun.jdi.ThreadReference

  private static Value evalJdiMember(CommonTree node) {
   
    CommonTree objNode = (CommonTree)node.getChild(0);
    String memberName = node.getChild(1).getText();
   
    ThreadReference threadRef = checkAndGetCurrentThread();
    ObjectReference thisObj = null;
   
    try {
      thisObj = (ObjectReference)evalTreeNode(objNode);
      Value value = findValueInFrame(threadRef, memberName, thisObj);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.