Search in sources :

Example 11 with SourceFile

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"));
    }
}
Also used : InProgressException(flash.tools.debugger.InProgressException) HashMap(java.util.HashMap) SwfInfo(flash.tools.debugger.SwfInfo) DSwfInfo(flash.tools.debugger.concrete.DSwfInfo) SourceFile(flash.tools.debugger.SourceFile)

Example 12 with SourceFile

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));
}
Also used : SourceFile(flash.tools.debugger.SourceFile) Vector(java.util.Vector)

Example 13 with SourceFile

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"));
    }
}
Also used : SourceFile(flash.tools.debugger.SourceFile) Location(flash.tools.debugger.Location)

Example 14 with SourceFile

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;
}
Also used : SourceFile(flash.tools.debugger.SourceFile) VersionException(flash.tools.debugger.VersionException) PlayerFaultException(flash.tools.debugger.expression.PlayerFaultException) ParseException(java.text.ParseException) NotSupportedException(flash.tools.debugger.NotSupportedException) PlayerDebugException(flash.tools.debugger.PlayerDebugException) NotSuspendedException(flash.tools.debugger.NotSuspendedException) EOFException(java.io.EOFException) SuspendedException(flash.tools.debugger.SuspendedException) FileNotFoundException(java.io.FileNotFoundException) InProgressException(flash.tools.debugger.InProgressException) NoResponseException(flash.tools.debugger.NoResponseException) SocketException(java.net.SocketException) NoSuchVariableException(flash.tools.debugger.expression.NoSuchVariableException) SocketTimeoutException(java.net.SocketTimeoutException) NoSuchElementException(java.util.NoSuchElementException) IOException(java.io.IOException) NotConnectedException(flash.tools.debugger.NotConnectedException)

Example 15 with SourceFile

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));
}
Also used : StackTraceResponseBody(com.nextgenactionscript.vscode.debug.responses.StackTraceResponseBody) StackFrame(com.nextgenactionscript.vscode.debug.responses.StackFrame) Frame(flash.tools.debugger.Frame) NotConnectedException(flash.tools.debugger.NotConnectedException) StackFrame(com.nextgenactionscript.vscode.debug.responses.StackFrame) ArrayList(java.util.ArrayList) SourceFile(flash.tools.debugger.SourceFile) SourceBreakpoint(com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint) Breakpoint(com.nextgenactionscript.vscode.debug.responses.Breakpoint) Source(com.nextgenactionscript.vscode.debug.requests.Source) Location(flash.tools.debugger.Location)

Aggregations

SourceFile (flash.tools.debugger.SourceFile)30 Location (flash.tools.debugger.Location)15 HashMap (java.util.HashMap)13 InProgressException (flash.tools.debugger.InProgressException)9 Map (java.util.Map)9 ParseException (java.text.ParseException)7 NotConnectedException (flash.tools.debugger.NotConnectedException)6 SwfInfo (flash.tools.debugger.SwfInfo)5 PlayerDebugException (flash.tools.debugger.PlayerDebugException)4 DSwfInfo (flash.tools.debugger.concrete.DSwfInfo)4 NoResponseException (flash.tools.debugger.NoResponseException)3 ArrayList (java.util.ArrayList)3 SourceBreakpoint (com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint)2 Breakpoint (com.nextgenactionscript.vscode.debug.responses.Breakpoint)2 Frame (flash.tools.debugger.Frame)2 NotSupportedException (flash.tools.debugger.NotSupportedException)2 NotSuspendedException (flash.tools.debugger.NotSuspendedException)2 SuspendedException (flash.tools.debugger.SuspendedException)2 Variable (flash.tools.debugger.Variable)2 VersionException (flash.tools.debugger.VersionException)2