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


Java DebuggerSupport类代码示例

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


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

示例1: getObjectForID

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
 * Gets the object corresponding to a given JDWP objectID value.
 *
 * @param objectID  the identifier denoting an object
 * @return the object corresponding to <code>id</code> or null if the object has been garbage collected
 * @throws SDWPException if <code>objectID</code> does not denote a null object but the object it does denote
 *                  has been garbage collected
 */
public synchronized Object getObjectForID(ObjectID objectID) throws SDWPException {
    int id = objectID.id;
    if (id == 0) {
        return null;
    } else if (id > 0) {
        Object object = objects.get(id);
        if (object == null) {
            throw new SDWPException(JDWP.Error_INVALID_OBJECT, "object ID denotes a non-existent or garbage collected object: " + id);
        }
        return object;
    } else {
        return DebuggerSupport.getROMObjectForID(-id);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:23,代码来源:ObjectManager.java

示例2: dispatch

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
         * {@inheritDoc}
         */
        protected boolean dispatch() throws IOException, SDWPException {
/*if[ENABLE_SDA_DEBUGGER]*/
            ObjectID threadID = in.readObjectID("thread");
            thread = sda.getObjectManager().getThreadForID(threadID);
            from = thread.getEventExecutionPoint();
            FrameID frameID = in.readFrameID("frame");
            frameNo = frameID.frame;

            SDPListener.checkThreadSuspendedState(thread); // check that thread is suspended but alive:
            
            if (!frameID.threadID.equals(threadID)) {
                throw new SDWPException(JDWP.Error_INVALID_FRAMEID, "frameID.thread [" + frameID.threadID + "] is inconsistent with threadID ["+threadID+"]");
            }
            if (frameNo < 0 || frameNo > DebuggerSupport.countStackFrames(thread, from)) {
                throw new SDWPException(JDWP.Error_INVALID_FRAMEID, "invalid frame number " + frameNo);
            }

            try {
                thread.suspendForDebugger();
                
                switch (command.command()) {
                    case JDWP.StackFrame_GetValues_COMMAND:  GetValues();  break;
                    case JDWP.StackFrame_ThisObject_COMMAND: ThisObject(); break;
                    case JDWP.StackFrame_SetValues_COMMAND:  SetValues();  break;
                    default: return false;
                }
            } finally {
                thread.resumeForDebugger(false);
            }
/*end[ENABLE_SDA_DEBUGGER]*/
            return true;
        }
 
开发者ID:tomatsu,项目名称:squawk,代码行数:36,代码来源:SDPListener.java

示例3: FrameCount

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
 * Implements <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_ThreadReference_FrameCount">FrameCount</a>.
 */
private void FrameCount() throws IOException, SDWPException {
    // The frames cannot be inspected if the thread is not suspended
    SDPListener.checkThreadSuspendedState(thread);
    try {
        thread.suspendForDebugger(); // make sure that thread doesn't restart while we are looking at it:
        int count = DebuggerSupport.countStackFrames(thread, from);
        out.writeInt(count, "frameCount");
    } finally {
        thread.resumeForDebugger(false);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:15,代码来源:SDPListener.java

示例4: dispatch

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
protected boolean dispatch() throws IOException, SDWPException {

    ObjectID threadID = in.readObjectID("thread");
    thread = sda.getObjectManager().getThreadForID(threadID);
    from = thread.getEventExecutionPoint();
    FrameID frameID = in.readFrameID("frame");
    frameNo = frameID.frame;

    SDPListener.checkThreadSuspendedState(thread); // check that thread is suspended but alive:
    
    if (!frameID.threadID.equals(threadID)) {
        throw new SDWPException(JDWP.Error_INVALID_FRAMEID, "frameID.thread [" + frameID.threadID + "] is inconsistent with threadID ["+threadID+"]");
    }
    if (frameNo < 0 || frameNo > DebuggerSupport.countStackFrames(thread, from)) {
        throw new SDWPException(JDWP.Error_INVALID_FRAMEID, "invalid frame number " + frameNo);
    }

    try {
        thread.suspendForDebugger();
        
        switch (command.command()) {
            case JDWP.StackFrame_GetValues_COMMAND:  GetValues();  break;
            case JDWP.StackFrame_ThisObject_COMMAND: ThisObject(); break;
            case JDWP.StackFrame_SetValues_COMMAND:  SetValues();  break;
            default: return false;
        }
    } finally {
        thread.resumeForDebugger(false);
    }

    return true;
}
 
开发者ID:sics-sse,项目名称:moped,代码行数:36,代码来源:SDPListener.java

示例5: GetValues

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
 * Implements <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_ReferenceType_GetValues">GetValues</a>.
 */
private void GetValues(Klass klass) throws SDWPException, IOException {
    Isolate isolate = sda.getDebuggeeIsolate();
    int count = in.readInt("fields");
    out.writeInt(count, "values");
    for (int i = 0; i < count; i++) {
        FieldID fieldID = in.readFieldID("fieldID");
        accessCheck(klass, fieldID, true);
        Klass definingClass = sda.getClassForID(fieldID.definingClass, JDWP.Error_INVALID_CLASS);
        int offset = fieldID.getOffset();
        byte tag = fieldID.getTag();
        
        if (Log.DEBUG_ENABLED && Log.debug()) {
            Log.log("    static field in " + klass + " of type " + (char) tag + " at offset " + offset);
        }
        // This should only occur if the proxy did not intercept a constant field or
        // it did not mask a global field from the debugger
        Assert.that(offset < definingClass.getStaticFieldsSize(), "field offset is out of range");

        switch (tag) {
            case JDWP.Tag_BYTE:
            case JDWP.Tag_BOOLEAN:
            case JDWP.Tag_CHAR:
            case JDWP.Tag_SHORT:
            case JDWP.Tag_INT:
            case JDWP.Tag_FLOAT:
                out.writePrimitive(tag, DebuggerSupport.getStaticInt(isolate, definingClass, offset), "1-word value");
                break;
            case JDWP.Tag_LONG:
            case JDWP.Tag_DOUBLE:
                out.writePrimitive(tag, DebuggerSupport.getStaticLong(isolate, definingClass, offset), "2-word value");
                break;
            case JDWP.Tag_OBJECT:
            case JDWP.Tag_STRING:
            case JDWP.Tag_THREAD:
            case JDWP.Tag_CLASS_OBJECT:
            case JDWP.Tag_ARRAY: {
                Object object = DebuggerSupport.getStaticOop(isolate, definingClass, offset);
                sda.getObjectManager().writeTaggedObject(out, object, "object value");
                break;
            }
            default:
                Assert.shouldNotReachHere();
        }
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:49,代码来源:SDPListener.java

示例6: SetValues

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
/**
 * Implements <a href="http://java.sun.com/j2se/1.5.0/docs/guide/jpda/jdwp/jdwp-protocol.html#JDWP_ClassType_SetValues">SetValues</a>
 * Proxy adds fields types so we can do type checking of reference fields....
 */
private void SetValues(Klass klass) throws SDWPException, IOException {
    Isolate isolate = sda.getDebuggeeIsolate();
    int count = in.readInt("values");

    for (int i = 0; i < count; i++) {
        FieldID fieldID = in.readFieldID("fieldID");
        accessCheck(klass, fieldID, true);
        Klass definingClass = sda.getClassForID(fieldID.definingClass, JDWP.Error_INVALID_CLASS);
        int offset = fieldID.getOffset();
        byte tag = fieldID.getTag();

        if (Log.verbose()) {
            Log.log("    static field in " + klass + " of type " + (char) tag + " at offset " + offset);
        }
        // This should only occur if the proxy did not intercept a constant field or
        // it did not mask a global field from the debugger
        Assert.that(offset < definingClass.getStaticFieldsSize(), "field offset is out of range");

        ReferenceTypeID fieldTypeID = in.readReferenceTypeID("fieldType");
        Klass fieldTypeKlass = sda.getClassForID(fieldTypeID, JDWP.Error_INVALID_CLASS);
    
        switch (tag) {
            case JDWP.Tag_BYTE:
            case JDWP.Tag_BOOLEAN:
                DebuggerSupport.setStaticInt(isolate,  definingClass, offset, in.readByte("untagged value"));
                break;
            case JDWP.Tag_CHAR:
            case JDWP.Tag_SHORT:
                DebuggerSupport.setStaticInt(isolate,  definingClass, offset, in.readShort("untagged value"));
                break;
            case JDWP.Tag_INT:
            case JDWP.Tag_FLOAT:
                DebuggerSupport.setStaticInt(isolate,  definingClass, offset, in.readInt("untagged value"));
                break;
            case JDWP.Tag_LONG:
            case JDWP.Tag_DOUBLE:
                DebuggerSupport.setStaticLong(isolate, definingClass, offset, in.readLong("untagged value"));
                break;
            case JDWP.Tag_OBJECT:
            case JDWP.Tag_STRING:
            case JDWP.Tag_THREAD:
            case JDWP.Tag_CLASS_OBJECT:
            case JDWP.Tag_ARRAY: {
                ObjectID valueID = in.readObjectID("untagged value");
                Object value = sda.getObjectManager().getObjectForID(valueID);
                typeCheck(value, fieldTypeKlass);
                DebuggerSupport.setStaticOop(isolate, definingClass, offset, value);
                break;
            }
            default:
                Assert.shouldNotReachHere();
        }
    }
    
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:60,代码来源:SDPListener.java

示例7: frames0

import com.sun.squawk.DebuggerSupport; //导入依赖的package包/类
private void frames0() throws SDWPException, IOException {
    final int startFrame = in.readInt("startFrame");
    final int length = in.readInt("length");
    
    final int totalFrames = DebuggerSupport.countStackFrames(thread, from);
    final int availFrames = totalFrames - startFrame;
    final int endFrame = (length == -1) ? availFrames : startFrame + length;

    if (startFrame < 0 || endFrame <= startFrame || endFrame > totalFrames) {
        throw new SDWPException(JDWP.Error_INVALID_THREAD, "'startFrame' or 'length' value is invalid. startFrame: " + startFrame + " endFrame: " + endFrame);
    }

    out.writeInt(endFrame - startFrame, "frames");
    DebuggerSupport.StackInspector inspector = new DebuggerSupport.StackInspector(thread, false) {
        private Exception exception;
        public void inspectFrame(Object mp, Offset bciWord, int frame, Offset fpOffset) {
            if (exception == null && startFrame <= frame && frame < endFrame) {

                int bci = bciWord.toInt();
                if (frame != 0 || DebuggerSupport.isAtExceptionBreakpoint(vmThread)) {
                    // if we're at an exception or in any frame but the inner most, ip is
                    // one after the currently executing instruction in the frame
                    bci--;
                }

                Klass definingClass = DebuggerSupport.getDefiningClass(mp);
                MethodID methodID = DebuggerSupport.getIDForMethodBody(definingClass, mp);
                ReferenceTypeID definingClassID = sda.getIDForClass(definingClass);
                Location location = new Location(JDWP.getTypeTag(definingClass), definingClassID, methodID, bci);
                Assert.that(DebuggerSupport.getMethodBody(definingClass, methodID.getOffset(), methodID.isStatic()) == mp, "bad method lookup");

                if (Log.DEBUG_ENABLED && Log.debug()) {
                    Log.log("    " + definingClass + "[mid=" + methodID + "]@" + bci);
                }

                try {
                    out.writeFrameID(new FrameID(sda.getObjectManager().getIDForObject(vmThread), frame), "frameID");
                    out.writeLocation(location, "location");
                } catch (IOException e) {
                    exception = e;
                }
            }
        }
        public Object getResult() {
            return exception;
        }
    };

    DebuggerSupport.inspectStack(inspector, from, -1);
    Object result = inspector.getResult();
    if (result instanceof IOException) {
        throw (IOException)result;
    } else if (result instanceof SDWPException) {
        throw (SDWPException)result;
    } else {
        Assert.that(result == null);
    }
}
 
开发者ID:tomatsu,项目名称:squawk,代码行数:59,代码来源:SDPListener.java


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