use of flash.tools.debugger.Frame 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.Frame 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.Frame in project intellij-plugins by JetBrains.
the class DebugCLI method setListingToFrame.
// set the listing command to point to the file/line of the given frame
void setListingToFrame(int frameNum) throws PlayerDebugException {
// set the module and line
Frame[] frames = m_session.getFrames();
Frame ctx = frames[frameNum];
Location l = ctx.getLocation();
SourceFile f = l.getFile();
int id = f.getId();
int line = l.getLine();
setListingPosition(id, line);
}
use of flash.tools.debugger.Frame in project intellij-plugins by JetBrains.
the class DebugCLI method doInfoScopeChain.
void doInfoScopeChain() throws PlayerDebugException {
waitTilHalted();
// dump the scope chain
StringBuilder sb = new StringBuilder();
// use our expression cache formatting routine
try {
// get the scope chainfrom the requested frame
int num = propertyGet(DISPLAY_FRAME_NUMBER);
Frame[] ar = m_session.getFrames();
Frame ctx = ar[num];
Variable[] scopes = ctx.getScopeChain(m_session);
for (int i = 0; i < scopes.length; i++) {
Variable scope = scopes[i];
ExpressionCache.appendVariable(sb, scope);
sb.append(m_newline);
}
} catch (NullPointerException npe) {
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("noScopeChain"));
} catch (ArrayIndexOutOfBoundsException aix) {
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("notInValidFrame"));
}
out(sb.toString());
}
use of flash.tools.debugger.Frame in project intellij-plugins by JetBrains.
the class DebugCLI method getCurrentLocation.
Location getCurrentLocation() {
Location where = null;
try {
Frame[] ar = m_session.getFrames();
propertyPut(CURRENT_FRAME_DEPTH, (ar.length > 0) ? ar.length : 0);
where = ((ar.length > 0) ? ar[0].getLocation() : null);
} catch (PlayerDebugException pde) {
// where == null
}
return where;
}
Aggregations