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);
}
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"));
}
}
}
}
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;
}
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);
}
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);
}
Aggregations