Examples of BreakpointRequest


Examples of com.sun.jdi.request.BreakpointRequest

            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) {
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

                        event).referenceType();
                for (Integer line : lineList) {
                    List<Location> locations = classType.locationsOfLine(line);
                    if (!locations.isEmpty()) {
                        Location loc = locations.get(0);
                        BreakpointRequest breakpointRequest =
                            jdb.eventRequestManager.
                            createBreakpointRequest(loc);
                        breakpointRequest.setSuspendPolicy(
                                EventRequest.SUSPEND_ALL);
                        breakpointRequest.enable();
                        jdb.breakpointRegisterMap.put(
                                loc.toString(), breakpointRequest);
                        System.out.println(
                                String.format("Breakpoint set: " + loc));
                    }
                }
            }
            // set the possible deferred method breakpoints
            List<String> methodStrList = deferringMethodBreakpoint.get(className);
            if (methodStrList != null) {
                ReferenceType classType = ((ClassPrepareEvent)
                        event).referenceType();
                for (String methodStr : methodStrList) {
                    String[] params = methodStr.split("|");
                    // Generate the target argument type string list
                    String[] argTypeNames;
                    if (params.length > 1) {
                        argTypeNames = params[1].split(",");
                    } else {
                        argTypeNames = new String[0];
                    }
                    // Get all methods of the class
                    List<Method> methodList = classType.methodsByName(params[0]);
                    Method matchedMethod = null;
                    /*
                     * As the jdb command argument doesn't supply the result
                     * value type, it's impossible to generate a jni signature
                     * for the specified method. I just have to search...
                     */
                    for (Method m : methodList) {
                        List<String> types = m.argumentTypeNames();
                        if (types.size() != argTypeNames.length) {
                            continue;
                        } else {
                            boolean matched = true;
                            for (int i = 0; i < argTypeNames.length; i++) {
                                if (!types.get(i).equals(argTypeNames[i])) {
                                    matched = false;
                                    break;
                                }
                            }
                            if (matched) {
                                matchedMethod = m;
                                break;
                            }
                        }
                    }
                    if (null != matchedMethod) {
                        Location loc = matchedMethod.location();
                        if (null != loc) {
                            BreakpointRequest breakpointRequest =
                                jdb.eventRequestManager.
                                createBreakpointRequest(loc);
                            breakpointRequest.setSuspendPolicy(
                                    EventRequest.SUSPEND_ALL);
                            breakpointRequest.enable();
                            jdb.breakpointRegisterMap.put(
                                    loc.toString(), breakpointRequest);
                            System.out.println(
                                    String.format("Breakpoint set: " + loc));
                        }
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

                                   JDIDebugTarget target) {
            ClassType classType = ( ClassType ) ((ClassPrepareEvent) event).referenceType();
            String name = classType.name();

            // change this to create a breakpoint, as the method enter was too slow
            BreakpointRequest req = null;
            List list = classType.methodsByName( "onBreak" );
            if list.size() == 0 ) {
                throw new IllegalStateException( "MVELDebugHandler.onBreak cannot be found by JDI" );
            }
           
            Method method = ( Method ) list.get( 0 );
            if (method != null && !method.isNative()) {
                Location location = method.location();
                if (location != null && location.codeIndex() != -1) {
                    req = getEventRequestManager().createBreakpointRequest(location);
                    req.addThreadFilter( ((ClassPrepareEvent) event).thread() );
                    req.setSuspendPolicy( EventRequest.SUSPEND_ALL  );
                } else {
                    throw new IllegalStateException( "MVELDebugHandler.onBreak location cannot be found by JDI" );
                }
            }    else {
                throw new IllegalStateException( "MVELDebugHandler.onBreak cannot be found by JDI" );
            }
           

            //breakpointCatched

            /*field= type.fieldByName(getFieldName());
             Field field;
             EventRequest req= manager.createModificationWatchpointRequest(field);
             */
            //req.setSuspendPolicy( EventRequest.SUSPEND_EVENT_THREAD );
            addJDIEventListener(new IJDIEventListener() {

                public boolean handleEvent(Event event, JDIDebugTarget target) {
                    BreakpointEvent entryEvent = (BreakpointEvent) event;

                    //System.out.println( entryEvent + ":" + entryEvent.location() );

                    try {
                        IThread[] tharr = getThreads();
                        ThreadReference t = null;
                        DroolsThread t2 = null;
                        for (int i = 0; i < tharr.length; i++) {
                            DroolsThread th2 = (DroolsThread) tharr[i];
                            ThreadReference th2real = ((DroolsThread) tharr[i]).getUnderlyingThread();
                            if (th2real.suspendCount() == 1    && th2.getName().equals("main")) {
                                t = th2real;
                                t2 = (DroolsThread) th2;
                                th2real.suspend();
                                th2.setRunning(false);
                                th2.fireSuspendEvent(DebugEvent.CLIENT_REQUEST);
                                return true;
                            }
                        }
                    } catch (Exception t) {
                        logError(t);
                    }
                    return true;
                }

                public void wonSuspendVote(Event event, JDIDebugTarget target) {
                    // do nothing
                }

                public void eventSetComplete(Event event, JDIDebugTarget target, boolean suspend, EventSet eventSet) {
                    wonSuspendVote(event, target);
                }

                public boolean handleEvent(Event event, JDIDebugTarget target, boolean suspendVote, EventSet eventSet) {
                    return handleEvent(event, target);
                }

            }, req);

            req.enable();
           
            // now remove the ClassPrepareEvent
            removeJDIEventListener(MVELTraceHandler.this, ((ClassPrepareEvent) event).request() );

            return true;
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

  public void run() {
    VirtualMachine vm = communicationClass.virtualMachine();
    try {
      Location interceptIn = ((Method)communicationClass.methodsByName("interceptIn").get(0)).locationOfCodeIndex(2);
      Location interceptOut = ((Method)communicationClass.methodsByName("interceptOut").get(0)).locationOfCodeIndex(2);
      BreakpointRequest req =  vm.eventRequestManager().createBreakpointRequest(interceptIn);
      req.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
      req.setEnabled(true);
      req = vm.eventRequestManager().createBreakpointRequest(interceptOut);
      req.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
      req.setEnabled(true);
      final com.sun.jdi.event.EventQueue q = vm.eventQueue();
      boolean done = false;
      errorStream.println("== Handling I/O events...");
      while (true) {
        final EventSet es;
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

   * Creates, installs, and returns a line breakpoint request at the given
   * location for this breakpoint.
   */
  protected BreakpointRequest createLineBreakpointRequest(Location location,
      JDIDebugTarget target) throws CoreException {
    BreakpointRequest request = null;
    EventRequestManager manager = target.getEventRequestManager();
    if (manager != null) {
      try {
        request = manager.createBreakpointRequest(location);
        configureRequest(request, target);
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

        }
        Location location = method.location();
        if (location == null || location.codeIndex() == -1) {
          return null;
        }
        BreakpointRequest req = type.virtualMachine()
            .eventRequestManager()
            .createBreakpointRequest(location);
        configureRequest(req, target);
        return new EventRequest[] { req };
      }
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

    public void clear() {
        Iterator<BreakpointInfo> resolved = this.resolvedBreakpoints.iterator();
        while (resolved.hasNext()) {
            try {
                BreakpointInfo bpi = resolved.next();
                BreakpointRequest bpr = this.infoToRequest.get(bpi);
                if (bpr != null) {
                    bpr.disable();
                }
            } catch (VMDisconnectedException e) {
                // vm went away.
            }
        }
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

                    List<Location> locations = ref.locationsOfLine(breakpoint.getLineNumber());

                    // Set a breakpoint at the first location.
                    if (locations.size() >= 1) {
                        EventRequestManager mgr = vm.eventRequestManager();
                        BreakpointRequest req = mgr.createBreakpointRequest(locations.get(0));
                        req.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
                        if (breakpoint.getCountFilter() != -1) {
                            req.addCountFilter(breakpoint.getCountFilter());
                        }
                        req.enable();
                        this.infoToRequest.put(breakpoint, req);
                        return true;
                    }
                } catch (AbsentInformationException ex) {
                }
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

                    try {
                        locations = ref.locationsOfLine(bpi.getLineNumber());
                        // Set a breakpoint at the first location.
                        if (locations.size() >= 1) {
                            EventRequestManager mgr = vm.eventRequestManager();
                            BreakpointRequest req = mgr.createBreakpointRequest(locations.get(0));
                            req.setSuspendPolicy(EventRequest.SUSPEND_EVENT_THREAD);
                            if (bpi.getCountFilter() != -1) {
                                req.addCountFilter(bpi.getCountFilter());
                            }
                            // TODO: bpi.setThread(...)
                            bpi.setMethodInfo(this.session.getClassInformationProvider().getMethodInfo(req.location().method()));
                            req.enable();
                            this.infoToRequest.put(bpi, req);
                            // This breakpoint has been satisfied. Remove it from
                            // the unsatisfied list.
                            this.resolvedBreakpoints.add(bpi);
                            iterator.remove();
View Full Code Here

Examples of com.sun.jdi.request.BreakpointRequest

    void remove(BreakpointInfo bpi) {
        this.unresolvedBreakpoints.remove(bpi);
        this.resolvedBreakpoints.remove(bpi);
        this.requestedBreakpoints.remove(bpi);
        BreakpointRequest bpr = this.infoToRequest.get(bpi);
        try {
            if (bpr != null) {
                bpr.disable();
                this.infoToRequest.remove(bpi);
            }
        } catch (VMDisconnectedException e) {
            // vm went away.
        }
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.