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-7.6.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-7.5.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-7.4.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-7.1.17 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-6.2.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-6.0.11 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.18 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.17 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.15 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.0.22 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.0.7 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.0.3 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-5.5.0 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
tauplatform-1.0.3 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
tauplatform-1.0.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
tauplatform-1.0.1 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-3.5.1.12 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-3.3.5 platform/shared/xruby/src/com/xruby/debug/NextInsn.java
rhodes-3.4.2 platform/shared/xruby/src/com/xruby/debug/NextInsn.java