Sha256: db3a75008a56e9fc244ffea24ef41885ce399fb8a4247ef395b7c71ae67f64f7

Contents?: true

Size: 1.76 KB

Versions: 135

Compression:

Stored size: 1.76 KB

Contents

/*
 * Copyright 2006-2007 Yu Su
 * Distributed under the BSD License
 */
package com.xruby.debug;

import com.sun.jdi.ThreadReference;
import com.sun.jdi.request.EventRequestManager;
import com.sun.jdi.request.StepRequest;

import java.util.List;

/**
 * Next step
 *
 * @author Yu Su (beanworms@gmail.com)
 */
public class NextInsn implements Instruction {
    private static final String[] excludes = {"java.*", "javax.*", "sun.*", "com.sun.*", "com.xruby.*"};
    
    public Result execute() {
        ThreadInfo threadInfo = ThreadInfo.getCurrentThreadInfo();
        if (threadInfo == null) {
            return null;
        }
        clearPreviousStep(threadInfo.getThread());
        EventRequestManager reqMgr = DebugContext.getEventRequestManager();
        StepRequest request = reqMgr.createStepRequest(threadInfo.getThread(),
                StepRequest.STEP_LINE,
                StepRequest.STEP_OVER);
        addExcludes(request);
        // We want just the next step event and no others
        request.addCountFilter(1);
        request.enable();
        ThreadInfo.invalidateAll();
        DebugContext.getJVM().resume();
        
        return null;
    }

    private void clearPreviousStep(ThreadReference thread) {
        EventRequestManager reqMgr = DebugContext.getEventRequestManager();
        List<StepRequest> requests = reqMgr.stepRequests();
        for (StepRequest request : requests) {
            if (request.thread().equals(thread)) {
                reqMgr.deleteEventRequest(request);
                break;
            }
        }
    }

    private void addExcludes(StepRequest request) {
        for(String pattern: excludes) {
            request.addClassExclusionFilter(pattern);
        }
    }
}

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-2.2.3.beta.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.2.beta.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.1.beta.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.1.beta.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.0.beta.3 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.0.beta.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.2.0.beta.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.1.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.3 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.rc2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.rc1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.beta11 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.beta10 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.beta9 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-2.0.0.beta8 platform/shared/xruby/src/com/xruby/debug/NextInsn.java