当前位置: 首页>>代码示例>>Java>>正文


Java BreakpointRequest类代码示例

本文整理汇总了Java中com.sun.jdi.request.BreakpointRequest的典型用法代码示例。如果您正苦于以下问题:Java BreakpointRequest类的具体用法?Java BreakpointRequest怎么用?Java BreakpointRequest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BreakpointRequest类属于com.sun.jdi.request包,在下文中一共展示了BreakpointRequest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: submitCheckForMonitorEntered

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
private void submitCheckForMonitorEntered(ObjectReference waitingMonitor) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper, ObjectCollectedExceptionWrapper, IllegalThreadStateExceptionWrapper {
    try {
        ThreadReferenceWrapper.suspend(threadReference);
        logger.fine("submitCheckForMonitorEntered(): suspending "+threadName);
        ObjectReference monitor = ThreadReferenceWrapper.currentContendedMonitor(threadReference);
        if (monitor == null) return ;
        Location loc = StackFrameWrapper.location(ThreadReferenceWrapper.frame(threadReference, 0));
        loc = MethodWrapper.locationOfCodeIndex(LocationWrapper.method(loc), LocationWrapper.codeIndex(loc) + 1);
        if (loc == null) return;
        BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest(
                VirtualMachineWrapper.eventRequestManager(MirrorWrapper.virtualMachine(threadReference)), loc);
        BreakpointRequestWrapper.addThreadFilter(br, threadReference);
        submitMonitorEnteredRequest(br);
    } catch (IncompatibleThreadStateException itex) {
        Exceptions.printStackTrace(itex);
    } catch (InvalidStackFrameExceptionWrapper isex) {
        Exceptions.printStackTrace(isex);
    } finally {
        logger.fine("submitCheckForMonitorEntered(): resuming "+threadName);
        ThreadReferenceWrapper.resume(threadReference);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:JPDAThreadImpl.java

示例2: isAtBreakpoint

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
public boolean isAtBreakpoint() {
    /*
     * TO DO: This fails to take filters into account.
     */
    try {
        StackFrame frame = frame(0);
        Location location = frame.location();
        List<BreakpointRequest> requests = vm.eventRequestManager().breakpointRequests();
        Iterator<BreakpointRequest> iter = requests.iterator();
        while (iter.hasNext()) {
            BreakpointRequest request = iter.next();
            if (location.equals(request.location())) {
                return true;
            }
        }
        return false;
    } catch (IndexOutOfBoundsException iobe) {
        return false;  // no frames on stack => not at breakpoint
    } catch (IncompatibleThreadStateException itse) {
        // Per the javadoc, not suspended => return false
        return false;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:ThreadReferenceImpl.java

示例3: addBreakpoint

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
private static void addBreakpoint(VirtualMachine vm, ReferenceType refType) {
    Location breakpointLocation = null;
    List<Location> locs;
    try {
        locs = refType.allLineLocations();
        for (Location loc: locs) {
            if (loc.method().name().equals(METHOD_NAME)) {
                breakpointLocation = loc;
                break;
            }
        }
    } catch (AbsentInformationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    if (breakpointLocation != null) {
        EventRequestManager evtReqMgr = vm.eventRequestManager();
        BreakpointRequest bReq = evtReqMgr.createBreakpointRequest(breakpointLocation);
        bReq.setSuspendPolicy(BreakpointRequest.SUSPEND_ALL);
        bReq.enable();
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:GetObjectLockCount.java

示例4: getAllBreakpoints

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
@Override
public List<Breakpoint> getAllBreakpoints() throws DebuggerException {
  List<BreakpointRequest> breakpointRequests;
  try {
    breakpointRequests = getEventManager().breakpointRequests();
  } catch (DebuggerException e) {
    Throwable cause = e.getCause();
    if (cause instanceof VMCannotBeModifiedException) {
      // If target VM in read-only state then list of break point always empty.
      return emptyList();
    }
    throw e;
  }
  List<Breakpoint> breakPoints = new ArrayList<>(breakpointRequests.size());
  for (BreakpointRequest breakpointRequest : breakpointRequests) {
    com.sun.jdi.Location location = breakpointRequest.location();
    // Breakpoint always enabled at the moment. Managing states of breakpoint is not supported for
    // now.
    breakPoints.add(
        newDto(BreakpointDto.class)
            .withEnabled(true)
            .withLocation(asDto(new JdbLocation(location))));
  }
  breakPoints.sort(BREAKPOINT_COMPARATOR);
  return breakPoints;
}
 
开发者ID:eclipse,项目名称:che,代码行数:27,代码来源:JavaDebugger.java

示例5: deleteBreakpoint

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
@Override
public void deleteBreakpoint(Location location) throws DebuggerException {
  final String className = debuggerUtil.findFqnByPosition(location);
  final int lineNumber = location.getLineNumber();
  EventRequestManager requestManager = getEventManager();
  List<BreakpointRequest> snapshot = new ArrayList<>(requestManager.breakpointRequests());
  for (BreakpointRequest breakpointRequest : snapshot) {
    com.sun.jdi.Location jdiLocation = breakpointRequest.location();
    if (jdiLocation.declaringType().name().equals(className)
        && jdiLocation.lineNumber() == lineNumber) {
      requestManager.deleteEventRequest(breakpointRequest);
      LOG.debug("Delete breakpoint: {}", location);
    }
  }

  List<Breakpoint> defferedByClass = deferredBreakpoints.get(className);
  if (defferedByClass != null) {
    defferedByClass.removeIf(
        breakpoint -> {
          Location l = breakpoint.getLocation();
          return l.getLineNumber() == location.getLineNumber()
              && l.getTarget().equals(location.getTarget());
        });
  }
}
 
开发者ID:eclipse,项目名称:che,代码行数:26,代码来源:JavaDebugger.java

示例6: isAtBreakpoint

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
public boolean isAtBreakpoint() {
    /*
     * TO DO: This fails to take filters into account.
     */
    try {
        StackFrame frame = frame(0);
        Location location = frame.location();
        List requests = vm.eventRequestManager().breakpointRequests();
        Iterator iter = requests.iterator();
        while (iter.hasNext()) {
            BreakpointRequest request = (BreakpointRequest)iter.next();
            if (location.equals(request.location())) {
                return true;
            }
        }
        return false;
    } catch (IndexOutOfBoundsException iobe) {
        return false;  // no frames on stack => not at breakpoint
    } catch (IncompatibleThreadStateException itse) {
        // Per the javadoc, not suspended => return false
        return false;
    }
}
 
开发者ID:openjdk,项目名称:jdk7-jdk,代码行数:24,代码来源:ThreadReferenceImpl.java

示例7: run

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
@SuppressWarnings("unchecked")
final String run(String[] args) {
    /*
     * TODO have not include deferred breakpoints yet
     */
    List<BreakpointRequest> list = 
        jdb.eventRequestManager.breakpointRequests();
    if (list.size() == 0) {
        return "No breakpoints set.";
    } else {
        StringBuilder sb = new StringBuilder();
        for (BreakpointRequest request : list) {
            sb.append(request.location() + "\n");
        }
        return sb.toString();
    }
}
 
开发者ID:shannah,项目名称:cn1,代码行数:18,代码来源:Main.java

示例8: areNewOrSubmittedTypes

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
/**
 * Checks whether the list of reference types are new types (the breakpoint
 * was not submitted anywhere yet), or are some of the types for which the
 * breakpoint was submitted already.
 * @param referenceTypes The types to check
 */
private boolean areNewOrSubmittedTypes(List<ReferenceType> referenceTypes) {
    List<EventRequest> eventRequests = getEventRequests();
    List<BreakpointRequest> brs = new LinkedList<BreakpointRequest>();
    for (EventRequest er : eventRequests) {
        if (er instanceof BreakpointRequest) {
            brs.add((BreakpointRequest) er);
        }
    }
    if (brs.isEmpty()) {
        return true;
    }
    for (ReferenceType rt : referenceTypes) {
        // Check whether breakpoint requests' types contains rt:
        boolean contains = false;
        for (BreakpointRequest br : brs) {
            ReferenceType brt = br.location().declaringType();
            if (rt.equals(brt)) {
                contains = true;
                break;
            }
        }
        if (!contains) {
            return false;
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:34,代码来源:LineBreakpointImpl.java

示例9: createEventRequest

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
@Override
protected EventRequest createEventRequest(EventRequest oldRequest) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
    Location location = BreakpointRequestWrapper.location((BreakpointRequest) oldRequest);
    BreakpointRequest br = EventRequestManagerWrapper.createBreakpointRequest(getEventRequestManager(), location);
    setFilters(br);
    return br;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:LineBreakpointImpl.java

示例10: setFilters

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
private void setFilters(BreakpointRequest br) throws InternalExceptionWrapper, VMDisconnectedExceptionWrapper {
    JPDAThread[] threadFilters = getBreakpoint().getThreadFilters(getDebugger());
    if (threadFilters != null && threadFilters.length > 0) {
        for (JPDAThread t : threadFilters) {
            BreakpointRequestWrapper.addThreadFilter(br, ((JPDAThreadImpl) t).getThreadReference());
        }
    }
    ObjectVariable[] varFilters = getBreakpoint().getInstanceFilters(getDebugger());
    if (varFilters != null && varFilters.length > 0) {
        for (ObjectVariable v : varFilters) {
            BreakpointRequestWrapper.addInstanceFilter(br, (ObjectReference) ((JDIVariable) v).getJDIValue());
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:LineBreakpointImpl.java

示例11: createBreakpointRequest

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
public BreakpointRequest createBreakpointRequest(Location location) {
    validateMirror(location);
    if (location.codeIndex() == -1) {
        throw new NativeMethodException("Cannot set breakpoints on native methods");
    }
    return new BreakpointRequestImpl(location);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:EventRequestManagerImpl.java

示例12: setHitCount

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
@Override
public void setHitCount(int hitCount) {
    this.hitCount = hitCount;

    Observable.fromIterable(this.requests())
        .filter(request -> request instanceof BreakpointRequest)
        .subscribe(request -> {
            request.addCountFilter(hitCount);
            request.enable();
        });
}
 
开发者ID:Microsoft,项目名称:java-debug,代码行数:12,代码来源:Breakpoint.java

示例13: process

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
public void process(String accessControlClass, int lineNum) throws Exception {
  EventRequestManager erm = vm.eventRequestManager();
  Optional<ReferenceType> classRef = getFirstClassReference(accessControlClass);
  if (!classRef.isPresent()) {
    throw new ClassNotFoundException(String.format("Class %s not found", accessControlClass));
  }

  ReferenceType accRef = classRef.get();
  Field contextField = accRef.fieldByName("context");

  Location location = accRef.locationsOfLine(lineNum).get(0);

  BreakpointRequest br = erm.createBreakpointRequest(location);
  loop(br, contextField);
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:16,代码来源:PermissionDebugger.java

示例14: loop

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
private void loop(BreakpointRequest br, Field contextField) throws Exception {
  int lineNumber = br.location().lineNumber();

  br.setSuspendPolicy(BreakpointRequest.SUSPEND_EVENT_THREAD);
  br.enable();
  EventQueue evtQueue = vm.eventQueue();
  boolean run = true;
  while (run) {
    EventSet evtSet = evtQueue.remove();
    EventIterator evtIter = evtSet.eventIterator();
    while (evtIter.hasNext()) {
      try {
        Event evt = evtIter.next();
        EventRequest evtReq = evt.request();
        if (evtReq instanceof BreakpointRequest
            && ((BreakpointRequest) evtReq).location().lineNumber() == lineNumber) {
          new BreakpointProcessor(missingPerms)
              .processBreakpoint(contextField, (BreakpointEvent) evt);

          // TODO: 12/20/17 Remove when full loop processing is restored
          // run = false;
          System.out.println(missingPerms);
          missingPerms.clear();
        }
      } finally {
        evtSet.resume();
      }
    }
  }

  //    System.out.println(missingPerms);
  //    printPerms(missingPerms);
}
 
开发者ID:coyotesqrl,项目名称:acdebugger,代码行数:34,代码来源:PermissionDebugger.java

示例15: disableEventRequest

import com.sun.jdi.request.BreakpointRequest; //导入依赖的package包/类
private void disableEventRequest() {
    List<BreakpointRequest> breakpoint = threadRef.virtualMachine().eventRequestManager().breakpointRequests();
    for (int j = 0; j < breakpoint.size(); j++) {
        BreakpointRequest breakpointRequest = breakpoint.get(j);
        breakpointRequest.setEnabled(false);
    }

}
 
开发者ID:SpoonLabs,项目名称:nopol,代码行数:9,代码来源:DataCollector.java


注:本文中的com.sun.jdi.request.BreakpointRequest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。