use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method doShowFiles.
/**
* Dump the content of files in a raw format
*/
void doShowFiles() {
try {
StringBuilder sb = new StringBuilder();
Iterator itr = m_fileInfo.getAllFiles();
while (itr.hasNext()) {
SourceFile m = (SourceFile) ((Map.Entry) itr.next()).getValue();
String name = m.getName();
int id = m.getId();
String path = m.getFullPath();
sb.append(id);
sb.append(' ');
sb.append(path);
//$NON-NLS-1$
sb.append(", ");
sb.append(name);
sb.append(m_newline);
}
out(sb.toString());
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSourceFilesFound"));
}
}
use of flash.tools.debugger.SourceFile 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.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method doInfoFuncs.
void doInfoFuncs() {
StringBuilder sb = new StringBuilder();
String arg = null;
// we take an optional single arg which specifies a module
try {
// let's wait a bit for the background load to complete
waitForMetaData();
if (hasMoreTokens()) {
arg = nextToken();
//$NON-NLS-1$
int id = arg.equals(".") ? propertyGet(LIST_MODULE) : parseFileArg(-1, arg);
SourceFile m = m_fileInfo.getFile(id);
listFunctionsFor(sb, m);
} else {
SourceFile[] ar = m_fileInfo.getFileList();
if (ar == null)
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noSourceFilesFound"));
else {
for (int i = 0; ar != null && i < ar.length; i++) {
SourceFile m = ar[i];
listFunctionsFor(sb, m);
}
}
}
out(sb.toString());
} catch (NullPointerException npe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("noFunctionsFound"));
} catch (ParseException pe) {
err(pe.getMessage());
} catch (NoMatchException nme) {
err(nme.getMessage());
} catch (AmbiguousException ae) {
err(ae.getMessage());
} catch (InProgressException ipe) {
//$NON-NLS-1$
err(getLocalizationManager().getLocalizedTextString("functionListBeingPrepared"));
}
}
use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method propagateBreakpoints.
/**
* Propagate current breakpoints to the newly loaded swf.
*/
void propagateBreakpoints() throws NotConnectedException {
// get the newly added swf, which lands at the end list
SwfInfo[] swfs = m_fileInfo.getSwfs();
SwfInfo swf = (swfs.length > 1) ? swfs[swfs.length - 1] : null;
// now walk through all breakpoints propagating the
// the break for each source and line number we
// find in the new swf
int size = m_breakpoints.size();
for (int i = 0; (swf != null) && i < size; i++) {
// dont do this for single swf breakpoints
BreakAction bp = breakpointAt(i);
if (bp.isSingleSwf())
continue;
if (bp.getStatus() != BreakAction.RESOLVED)
continue;
try {
Location l = bp.getLocation();
int line = l.getLine();
SourceFile f = l.getFile();
Location newLoc = findAndEnableBreak(swf, f, line);
if (newLoc != null)
bp.addLocation(newLoc);
} catch (InProgressException ipe) {
if (breakpointCount() > 0) {
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("breakpointNumber", Integer.toString(bp.getId()));
//$NON-NLS-1$
out(getLocalizationManager().getLocalizedTextString("breakpointNotPropagated", args));
}
}
}
}
use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.
the class DebugCLI method doShowLocations.
void doShowLocations() {
StringBuilder sb = new StringBuilder();
sb.append("Num Type Disp Enb Address What" + m_newline);
// our list of breakpoints
int count = breakpointCount();
for (int i = 0; i < count; i++) {
BreakAction b = breakpointAt(i);
int num = b.getId();
FieldFormat.formatLong(sb, num, 3);
sb.append(" breakpoint ");
if (b.isAutoDisable())
sb.append("dis ");
else if (b.isAutoDelete())
sb.append("del ");
else
sb.append("keep ");
if (b.isEnabled())
sb.append("y ");
else
sb.append("n ");
Iterator<Location> itr = b.getLocations().iterator();
while (itr.hasNext()) {
Location l = itr.next();
SourceFile file = l.getFile();
String funcName = (file == null) ? //$NON-NLS-1$
getLocalizationManager().getLocalizedTextString("unknownBreakpointLocation") : file.getFunctionNameForLine(m_session, l.getLine());
int offset = adjustOffsetForUnitTests((file == null) ? 0 : file.getOffsetForLine(l.getLine()));
//$NON-NLS-1$
sb.append("0x");
FieldFormat.formatLongToHex(sb, offset, 8);
sb.append(' ');
if (funcName != null) {
Map<String, Object> funcArgs = new HashMap<String, Object>();
//$NON-NLS-1$
funcArgs.put("functionName", funcName);
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("inFunctionAt", funcArgs));
}
sb.append(file.getName());
if (file != null) {
//$NON-NLS-1$
sb.append("#");
sb.append(file.getId());
}
sb.append(':');
sb.append(l.getLine());
try {
SwfInfo info = m_fileInfo.swfForFile(file);
Map<String, Object> swfArgs = new HashMap<String, Object>();
//$NON-NLS-1$
swfArgs.put("swf", FileInfoCache.shortNameOfSwf(info));
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("inSwf", swfArgs));
} catch (NullPointerException npe) {
// can't find the swf
//$NON-NLS-1$
sb.append(getLocalizationManager().getLocalizedTextString("nonRestorable"));
}
sb.append(m_newline);
if (itr.hasNext())
//$NON-NLS-1$
sb.append(" ");
}
}
out(sb.toString());
}
Aggregations