Search in sources :

Example 1 with NoResponseException

use of flash.tools.debugger.NoResponseException in project intellij-plugins by JetBrains.

the class ExpressionCache method appendVariableValue.

/**
	 * Given any arbitrary constant value, such as a Double, a String, etc.,
	 * format its value appropriately. For example, strings will be quoted.
	 *
	 * @param sb
	 *            a StringBuilder to which the formatted value will be appended.
	 * @param o
	 *            the value to format.
	 */
public static void appendVariableValue(StringBuilder sb, final Object o) {
    Value v;
    if (o instanceof Value) {
        v = (Value) o;
    } else {
        v = new Value() {

            public int getAttributes() {
                return 0;
            }

            public String[] getClassHierarchy(boolean allLevels) {
                return new String[0];
            }

            public String getClassName() {
                //$NON-NLS-1$
                return "";
            }

            public long getId() {
                return UNKNOWN_ID;
            }

            public int getMemberCount(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException {
                return 0;
            }

            public Variable getMemberNamed(Session s, String name) throws NotSuspendedException, NoResponseException, NotConnectedException {
                return null;
            }

            public Variable[] getMembers(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException {
                return new Variable[0];
            }

            public int getType() {
                if (o instanceof Number)
                    return VariableType.NUMBER;
                else if (o instanceof Boolean)
                    return VariableType.BOOLEAN;
                else if (o instanceof String)
                    return VariableType.STRING;
                else if (o == Value.UNDEFINED)
                    return VariableType.UNDEFINED;
                else if (o == null)
                    return VariableType.NULL;
                assert false;
                return VariableType.UNKNOWN;
            }

            public String getTypeName() {
                //$NON-NLS-1$
                return "";
            }

            public Object getValueAsObject() {
                return o;
            }

            public String getValueAsString() {
                return DValue.getValueAsString(o);
            }

            public boolean isAttributeSet(int variableAttribute) {
                return false;
            }

            public Variable[] getPrivateInheritedMembers() {
                return new Variable[0];
            }

            public Variable[] getPrivateInheritedMemberNamed(String name) {
                return new Variable[0];
            }
        };
    }
    appendVariableValue(sb, v);
}
Also used : Variable(flash.tools.debugger.Variable) NotConnectedException(flash.tools.debugger.NotConnectedException) Value(flash.tools.debugger.Value) DValue(flash.tools.debugger.concrete.DValue) NotSuspendedException(flash.tools.debugger.NotSuspendedException) NoResponseException(flash.tools.debugger.NoResponseException) Session(flash.tools.debugger.Session)

Example 2 with NoResponseException

use of flash.tools.debugger.NoResponseException in project intellij-plugins by JetBrains.

the class DebugCLI method process.

/**
	 * Process this reader until its done
	 */
void process() throws IOException {
    boolean done = false;
    while (!done) {
        try {
            /**
				 * Now if we are in a session and that session is suspended then we go
				 * into a state where we wait for some user interaction to get us out
				 */
            runningLoop();
            /* if we are in the stdin then put out a prompt */
            if (!haveStreams())
                displayPrompt();
            /* now read in the next line */
            readLine();
            if (m_currentLine == null)
                break;
            done = processLine();
        } catch (NoResponseException nre) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("noResponseException"));
        } catch (NotSuspendedException nse) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("notSuspendedException"));
        } catch (AmbiguousException ae) {
        // we already put up a warning for the user
        } catch (IllegalStateException ise) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("illegalStateException"));
        } catch (IllegalMonitorStateException ime) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("illegalMonitorStateException"));
        } catch (NoSuchElementException nse) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("noSuchElementException"));
        } catch (NumberFormatException nfe) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("numberFormatException"));
        } catch (SocketException se) {
            Map socketArgs = new HashMap();
            //$NON-NLS-1$
            socketArgs.put("message", se.getMessage());
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("socketException", socketArgs));
        } catch (VersionException ve) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("versionException"));
        } catch (NotConnectedException nce) {
        // handled by isConnectionLost()
        } catch (Exception e) {
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("unexpectedError"));
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("stackTraceFollows"));
            e.printStackTrace();
        }
        // check for a lost connection and if it is clean-up!
        if (isConnectionLost()) {
            try {
                dumpHaltState(false);
            } catch (PlayerDebugException pde) {
                //$NON-NLS-1$
                err(getLocalizationManager().getLocalizedTextString("sessionEndedAbruptly"));
            }
        }
    }
}
Also used : SocketException(java.net.SocketException) NotConnectedException(flash.tools.debugger.NotConnectedException) HashMap(java.util.HashMap) NotSuspendedException(flash.tools.debugger.NotSuspendedException) PlayerDebugException(flash.tools.debugger.PlayerDebugException) VersionException(flash.tools.debugger.VersionException) PlayerFaultException(flash.tools.debugger.expression.PlayerFaultException) IncompleteExpressionException(flash.tools.debugger.expression.IncompleteExpressionException) ParseException(java.text.ParseException) PlayerDebugException(flash.tools.debugger.PlayerDebugException) NotSuspendedException(flash.tools.debugger.NotSuspendedException) EOFException(java.io.EOFException) SuspendedException(flash.tools.debugger.SuspendedException) FileNotFoundException(java.io.FileNotFoundException) InProgressException(flash.tools.debugger.InProgressException) NoResponseException(flash.tools.debugger.NoResponseException) UnknownOperationException(flash.tools.debugger.expression.UnknownOperationException) SocketException(java.net.SocketException) NoSuchVariableException(flash.tools.debugger.expression.NoSuchVariableException) SocketTimeoutException(java.net.SocketTimeoutException) NoSuchElementException(java.util.NoSuchElementException) EmptyStackException(java.util.EmptyStackException) IOException(java.io.IOException) NotConnectedException(flash.tools.debugger.NotConnectedException) NoResponseException(flash.tools.debugger.NoResponseException) Map(java.util.Map) HashMap(java.util.HashMap) NoSuchElementException(java.util.NoSuchElementException) VersionException(flash.tools.debugger.VersionException)

Example 3 with NoResponseException

use of flash.tools.debugger.NoResponseException in project intellij-plugins by JetBrains.

the class DebugCLI method doNext.

/**
	 * Perform step over, optional COUNT parameter
	 */
void doNext() throws PlayerDebugException {
    waitTilHalted();
    if (!allowedToStep())
        return;
    int count = 1;
    if (hasMoreTokens())
        count = nextIntToken();
    try {
        while (count-- > 0) {
            stepWithTimeout(new AnyKindOfStep() {

                public void step() throws PlayerDebugException {
                    m_session.stepOver();
                }
            });
            for (; ; ) {
                dumpStep();
                if (// perhaps we hit a conditional breakpoint
                m_requestResume) {
                    m_requestResume = false;
                    stepWithTimeout(new AnyKindOfStep() {

                        public void step() throws PlayerDebugException {
                            m_session.stepContinue();
                        }
                    });
                } else {
                    break;
                }
            }
        }
    } catch (NoResponseException nre) {
        if (count > 0) {
            Map args = new HashMap();
            //$NON-NLS-1$
            args.put("count", Integer.toString(count));
            //$NON-NLS-1$
            err(getLocalizationManager().getLocalizedTextString("abortingStep", args));
        }
    }
    m_repeatLine = m_currentLine;
}
Also used : HashMap(java.util.HashMap) PlayerDebugException(flash.tools.debugger.PlayerDebugException) NoResponseException(flash.tools.debugger.NoResponseException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with NoResponseException

use of flash.tools.debugger.NoResponseException in project intellij-plugins by JetBrains.

the class DebugCLI method removeWatchpointAt.

void removeWatchpointAt(int at) throws NotConnectedException {
    WatchAction b = watchpointAt(at);
    boolean worked = false;
    try {
        worked = (m_session.clearWatch(b.getWatch()) == null) ? false : true;
    } catch (NoResponseException nre) {
    }
    if (!worked) {
        Map args = new HashMap();
        //$NON-NLS-1$
        args.put("variable", b.getExpr());
        //$NON-NLS-1$
        err(getLocalizationManager().getLocalizedTextString("couldNotFindWatchpoint", args));
    }
    // remove in any event
    m_watchpoints.remove(at);
}
Also used : HashMap(java.util.HashMap) NoResponseException(flash.tools.debugger.NoResponseException) Map(java.util.Map) HashMap(java.util.HashMap)

Example 5 with NoResponseException

use of flash.tools.debugger.NoResponseException in project intellij-plugins by JetBrains.

the class DebugCLI method stepWithTimeout.

/**
	 * Helper function to do a stepInto, stepOver, stepOut, or stepContinue,
	 * and then to block (processing events) until either the step has completed
	 * or it has timed out.
	 */
private void stepWithTimeout(AnyKindOfStep step) throws PlayerDebugException {
    int timeout = m_session.getPreference(SessionManager.PREF_RESPONSE_TIMEOUT);
    long timeoutTime = System.currentTimeMillis() + timeout;
    step.step();
    while (System.currentTimeMillis() < timeoutTime && !m_session.isSuspended()) {
        processEvents();
        if (!m_session.isSuspended()) {
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
            }
        }
    }
    if (System.currentTimeMillis() >= timeoutTime && !m_session.isSuspended())
        throw new NoResponseException(timeout);
}
Also used : NoResponseException(flash.tools.debugger.NoResponseException)

Aggregations

NoResponseException (flash.tools.debugger.NoResponseException)8 NotConnectedException (flash.tools.debugger.NotConnectedException)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 InProgressException (flash.tools.debugger.InProgressException)2 Location (flash.tools.debugger.Location)2 NotSuspendedException (flash.tools.debugger.NotSuspendedException)2 PlayerDebugException (flash.tools.debugger.PlayerDebugException)2 SwfInfo (flash.tools.debugger.SwfInfo)2 SourceBreakpoint (com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint)1 Breakpoint (com.nextgenactionscript.vscode.debug.responses.Breakpoint)1 SetBreakpointsResponseBody (com.nextgenactionscript.vscode.debug.responses.SetBreakpointsResponseBody)1 Session (flash.tools.debugger.Session)1 SourceFile (flash.tools.debugger.SourceFile)1 SuspendedException (flash.tools.debugger.SuspendedException)1 Value (flash.tools.debugger.Value)1 Variable (flash.tools.debugger.Variable)1 VersionException (flash.tools.debugger.VersionException)1 DSwfInfo (flash.tools.debugger.concrete.DSwfInfo)1 DValue (flash.tools.debugger.concrete.DValue)1