use of flash.tools.debugger.PlayerDebugException in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method scopes.
public void scopes(Response response, ScopesRequest.ScopesArguments arguments) {
List<Scope> scopes = new ArrayList<>();
int frameId = arguments.frameId;
try {
Frame[] swfFrames = swfSession.getFrames();
if (frameId >= 0 && frameId < swfFrames.length) {
Scope localScope = new Scope();
localScope.name = "Locals";
//this is a hacky way to store the frameId
localScope.variablesReference = frameId * 10 + LOCAL_VARIABLES_REFERENCE;
scopes.add(localScope);
}
} catch (PlayerDebugException e) {
//ignore and return no scopes
}
sendResponse(response, new ScopesResponseBody(scopes));
}
use of flash.tools.debugger.PlayerDebugException in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method variables.
public void variables(Response response, VariablesRequest.VariablesArguments arguments) {
List<Variable> variables = new ArrayList<>();
try {
Value swfValue = null;
long variablesReference = arguments.variablesReference;
int frameId = -1;
if (variablesReference < 1000) {
frameId = (int) variablesReference / 10;
variablesReference -= frameId * 10;
}
flash.tools.debugger.Variable[] members = null;
if (variablesReference == LOCAL_VARIABLES_REFERENCE) {
Frame[] swfFrames = swfSession.getFrames();
if (frameId >= 0 && frameId < swfFrames.length) {
Frame swfFrame = swfFrames[frameId];
flash.tools.debugger.Variable[] args = swfFrame.getArguments(swfSession);
flash.tools.debugger.Variable[] locals = swfFrame.getLocals(swfSession);
flash.tools.debugger.Variable swfThis = swfFrame.getThis(swfSession);
int memberCount = locals.length + args.length;
int offset = 0;
if (swfThis != null) {
offset = 1;
}
members = new flash.tools.debugger.Variable[memberCount + offset];
if (swfThis != null) {
members[0] = swfThis;
}
System.arraycopy(args, 0, members, offset, args.length);
System.arraycopy(locals, 0, members, args.length + offset, locals.length);
} else {
members = new flash.tools.debugger.Variable[0];
}
} else {
swfValue = swfSession.getValue(arguments.variablesReference);
members = swfValue.getMembers(swfSession);
}
for (flash.tools.debugger.Variable member : members) {
Value memberValue = member.getValue();
Variable variable = new Variable();
variable.name = member.getName();
variable.type = memberValue.getTypeName();
long id = memberValue.getId();
if (id != Value.UNKNOWN_ID) {
variable.value = memberValue.getTypeName();
variable.variablesReference = memberValue.getId();
} else {
if (memberValue.getType() == VariableType.STRING) {
variable.value = "\"" + memberValue.getValueAsString() + "\"";
} else {
variable.value = memberValue.getValueAsString();
}
}
variables.add(variable);
}
} catch (PlayerDebugException e) {
//ignore
}
sendResponse(response, new VariablesResponseBody(variables));
}
use of flash.tools.debugger.PlayerDebugException 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.PlayerDebugException 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.PlayerDebugException in project intellij-plugins by JetBrains.
the class DebugCLI method handleFault.
/**
* We have received a fault and are possibly suspended at this point.
* We need to look at our fault table and determine what do.
* @return true if we resumed execution
*/
boolean handleFault(FaultEvent e) {
// lookup what we need to do
boolean requestResume = false;
String name = e.name();
boolean stop = true;
boolean print = true;
try {
//$NON-NLS-1$
print = m_faultTable.is(name, "print");
//$NON-NLS-1$
stop = m_faultTable.is(name, "stop");
} catch (NullPointerException npe) {
if (Trace.error) {
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("faultName", name);
//$NON-NLS-1$
Trace.trace(getLocalizationManager().getLocalizedTextString("faultHasNoTableEntry", args));
npe.printStackTrace();
}
}
if (e instanceof ExceptionFault) {
ExceptionFault ef = (ExceptionFault) e;
Value thrownValue = ef.getThrownValue();
if (thrownValue != null) {
if (!ef.willExceptionBeCaught()) {
stop = true;
} else {
stop = false;
String typeName = thrownValue.getTypeName();
int at = typeName.indexOf('@');
if (at != -1)
typeName = typeName.substring(0, at);
for (int i = 0; i < catchpointCount(); ++i) {
CatchAction c = catchpointAt(i);
String typeToCatch = c.getTypeToCatch();
try {
if (typeToCatch == null || getSession().evalIs(thrownValue, typeToCatch)) {
stop = true;
break;
}
} catch (PlayerDebugException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
stop = true;
} catch (PlayerFaultException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
stop = true;
}
}
if (!stop)
print = false;
}
}
}
// should we stop?
if (!stop)
requestResume = true;
if (print)
dumpFaultLine(e);
return requestResume;
}
Aggregations