use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method doInfoSwfs.
/**
* Dump some stats about our currently loaded swfs.
*/
void doInfoSwfs() {
try {
StringBuilder sb = new StringBuilder();
SwfInfo[] swfs = m_fileInfo.getSwfs();
for (int i = 0; i < swfs.length; i++) {
SwfInfo e = swfs[i];
if (e == null || e.isUnloaded())
continue;
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("swfName", FileInfoCache.nameOfSwf(e));
//$NON-NLS-1$
args.put("size", NumberFormat.getInstance().format(e.getSwfSize()));
try {
int size = e.getSwdSize(m_session);
// our swd is loaded so let's comb through our
// list of scripts and locate the range of ids.
SourceFile[] files = e.getSourceList(m_session);
int max = Integer.MIN_VALUE;
int min = Integer.MAX_VALUE;
for (int j = 0; j < files.length; j++) {
SourceFile f = files[j];
int id = f.getId();
max = (id > max) ? id : max;
min = (id < min) ? id : min;
}
//$NON-NLS-1$
args.put("scriptCount", Integer.toString(e.getSourceCount(m_session)));
//$NON-NLS-1$
args.put("min", Integer.toString(min));
//$NON-NLS-1$
args.put("max", Integer.toString(max));
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
args.put("plus", (e.isProcessingComplete()) ? "+" : "");
//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
args.put("moreInfo", (size == 0) ? getLocalizationManager().getLocalizedTextString("remainingSourceBeingLoaded") : "");
} catch (InProgressException ipe) {
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("debugInfoBeingLoaded"));
}
//$NON-NLS-1$
args.put("url", e.getUrl());
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("swfInfo", args));
sb.append(m_newline);
}
out(sb.toString());
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSWFs"));
}
}
use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method buildFileList.
void buildFileList(StringBuilder sb, boolean authoredFilesOnly) {
SourceFile[] ar = m_fileInfo.getFileList();
if (ar == null) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSourceFilesFound"));
return;
}
Vector<String> authoredFiles = new Vector<String>();
Vector<String> frameworkFiles = new Vector<String>();
Vector<String> syntheticFiles = new Vector<String>();
Vector<String> actionsFiles = new Vector<String>();
for (int i = 0; i < ar.length; i++) {
SourceFile m = ar[i];
int fileType = getFileType(m);
int id = m.getId();
//$NON-NLS-1$
String entry = m.getName() + "#" + id;
switch(fileType) {
case SYNTHETIC_FILE:
syntheticFiles.add(entry);
break;
case FRAMEWORK_FILE:
frameworkFiles.add(entry);
break;
case ACTIONS_FILE:
actionsFiles.add(entry);
break;
case AUTHORED_FILE:
authoredFiles.add(entry);
break;
}
}
int wrapAt = propertyGet(FILE_LIST_WRAP);
if (!authoredFilesOnly) {
if (actionsFiles.size() > 0) {
appendStrings(sb, actionsFiles, (actionsFiles.size() > wrapAt));
}
if (frameworkFiles.size() > 0) {
//$NON-NLS-1$
sb.append("---" + m_newline);
appendStrings(sb, frameworkFiles, (frameworkFiles.size() > wrapAt));
}
if (syntheticFiles.size() > 0) {
//$NON-NLS-1$
sb.append("---" + m_newline);
appendStrings(sb, syntheticFiles, (syntheticFiles.size() > wrapAt));
}
//$NON-NLS-1$
sb.append("---" + m_newline);
}
appendStrings(sb, authoredFiles, (authoredFiles.size() > wrapAt));
}
use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method doHome.
/**
* Bring the listing location back to the current frame
*/
void doHome() {
try {
Location l = getCurrentLocation();
SourceFile file = l.getFile();
int module = file.getId();
int line = l.getLine();
// now set it
setListingPosition(module, line);
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("currentLocationUnknown"));
}
}
use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method module2ClassName.
/**
* Convert a module to class name. This is used
* by the ExpressionCache to find variables
* that live at royale package scope. That
* is variables such as mx.core.Component.
*/
public String module2ClassName(int moduleId) {
String pkg = null;
try {
SourceFile file = m_fileInfo.getFile(moduleId);
pkg = file.getPackageName();
} catch (Exception npe) {
// didn't work ignore it.
}
return pkg;
}
use of flash.tools.debugger.SourceFile in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method stackTrace.
public void stackTrace(Response response, StackTraceRequest.StackTraceArguments arguments) {
List<StackFrame> stackFrames = new ArrayList<>();
try {
Frame[] swfFrames = swfSession.getFrames();
for (int i = 0, count = swfFrames.length; i < count; i++) {
Frame swfFrame = swfFrames[i];
Location location = swfFrame.getLocation();
SourceFile file = location.getFile();
StackFrame stackFrame = new StackFrame();
stackFrame.id = i;
stackFrame.name = swfFrame.getCallSignature();
if (file != null) {
Source source = new Source();
source.name = file.getName();
source.path = transformPath(file.getFullPath());
stackFrame.source = source;
stackFrame.line = location.getLine();
stackFrame.column = 0;
}
stackFrames.add(stackFrame);
}
} catch (NotConnectedException e) {
//ignore
}
sendResponse(response, new StackTraceResponseBody(stackFrames));
}
Aggregations