Package com.sun.jdi

Examples of com.sun.jdi.ReferenceType


                throw new Error("target JVM cannot redefine classes, please force the use of -Xbootclasspath");
            }
            List classList = vm.classesByName(className);
            if (classList.size() == 0)
                throw new Error("Fatal error: Can't find class "+className);
            ReferenceType rt = (ReferenceType)classList.get(0);
            Map map = new HashMap();
            map.put(rt, bytes);
            Method doM = VirtualMachine.class.getMethod("redefineClasses", new Class[]{Map.class});
            doM.invoke(vm, new Object[]{map});
        } catch (NoSuchMethodException e) {
View Full Code Here


            String className = ((ClassPrepareEvent)
                    event).referenceType().name();
            // set the possible deferred line breakpoints
            List<Integer> lineList = deferringLineBreakpoint.get(className);
            if (lineList != null) {
                ReferenceType classType = ((ClassPrepareEvent)
                        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...
View Full Code Here

        } catch ( CoreException e1 ) {
            logError( e1 );
            return;
        }

        ReferenceType refType = (ReferenceType) debugHandlerClass;
        Method m = (Method) refType.methodsByName( "registerBreakpoint" ).iterator().next();
        List args = new ArrayList();
        IntegerValue lineVal = getVM().mirrorOf( line );
        StringReference nameVal = getVM().mirrorOf( sourceName );
        JDIObjectValue val = (JDIObjectValue) newValue( sourceName );
        ObjectReference realVal = val.getUnderlyingObject();
View Full Code Here

        } catch ( CoreException e1 ) {
            logError( e1 );
            return;
        }

        ReferenceType refType = (ReferenceType) debugHandlerClass;
        Method m = (Method) refType.methodsByName( "removeBreakpoint" ).iterator().next();
        List args = new ArrayList();
        IntegerValue lineVal = getVM().mirrorOf( line );
        StringReference nameVal = getVM().mirrorOf( sourceName );
        JDIObjectValue val = (JDIObjectValue) newValue( sourceName );
        ObjectReference realVal = val.getUnderlyingObject();
View Full Code Here

            }

            List<IVariable> result = new ArrayList<IVariable>( 0 );

            Method method = getUnderlyingMethod(); // onBreak
            ReferenceType declaringType = method.declaringType(); // org.drools.core.base.mvel.MVELDebugHandler

            try {
                Object var = method.variables().get( 0 );
                LocalVariable v2 = (LocalVariable) var;
                JDILocalVariable frameLocal = new JDILocalVariable( this,
View Full Code Here

        Iterator handleriter = getVM().classesByName( "org.drools.core.base.mvel.MVELDebugHandler" ).iterator();
        Object debugHandlerClass = handleriter.next();

        int line = step_over;

        ReferenceType refType = (ReferenceType) debugHandlerClass;
        Method m = (Method) refType.methodsByName( "setOnBreakReturn" ).iterator().next();
        List args = new ArrayList();
        IntegerValue lineVal = getVM().mirrorOf( line );
        //ObjectReference realVal = val.getUnderlyingObject();
        args.add( lineVal );
View Full Code Here

            }
            List classList = vm.classesByName(className);
            if (classList.size() == 0) {
                throw new Error("Fatal error: Can't find class " + className);
            }
            ReferenceType rt = (ReferenceType) classList.get(0);
            Map map = new HashMap();
            map.put(rt, bytes);
            Method doM = VirtualMachine.class.getMethod(
                    "redefineClasses", new Class[]{
                        Map.class
View Full Code Here

          connected = false;
        } else if (event instanceof ClassPrepareEvent) {
          // watch field on loaded class
          System.out.println("ClassPrepareEvent");
          ClassPrepareEvent classPrepEvent = (ClassPrepareEvent) event;
          ReferenceType refType = classPrepEvent
              .referenceType();
          addFieldWatch(vm, refType);
        } else if (event instanceof ModificationWatchpointEvent) {
          System.out.println("sleep for 500 ms");
          Thread.sleep(500);
View Full Code Here

     *
     * @param className the fully-qualified class name.
     * @param classFile the contents of the class file.
     */
    public void reload(String className, byte[] classFile) {
        ReferenceType classtype = toRefType(className);
        Map map = new HashMap();
        map.put(classtype, classFile);
        reload2(map, className);
    }
View Full Code Here

     *
     * @param className the fully-qualified class name.
     * @param classFile the contents of the class file.
     */
    public void reload(String className, byte[] classFile) {
        ReferenceType classtype = toRefType(className);
        Map map = new HashMap();
        map.put(classtype, classFile);
        reload2(map, className);
    }
View Full Code Here

TOP

Related Classes of com.sun.jdi.ReferenceType

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.