Search in sources :

Example 6 with Location

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

Example 7 with Location

use of flash.tools.debugger.Location in project intellij-plugins by JetBrains.

the class DebugCLI method enableBreakpoint.

boolean enableBreakpoint(BreakAction a, boolean autoDisable, boolean autoDelete) throws NotConnectedException {
    boolean retval = false;
    // use the first location as a source file / line number template 
    Location l = a.getLocation();
    if (l != null) {
        LocationCollection col = enableBreak(l.getFile(), l.getLine());
        if (!col.isEmpty()) {
            a.setEnabled(true);
            a.setLocations(col);
            a.setAutoDisable(autoDisable);
            a.setAutoDelete(autoDelete);
            a.setSingleSwf(false);
            a.setStatus(BreakAction.RESOLVED);
            retval = true;
        }
    }
    return retval;
}
Also used : Location(flash.tools.debugger.Location)

Example 8 with Location

use of flash.tools.debugger.Location 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;
}
Also used : Frame(flash.tools.debugger.Frame) PlayerDebugException(flash.tools.debugger.PlayerDebugException) Location(flash.tools.debugger.Location)

Example 9 with Location

use of flash.tools.debugger.Location 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 10 with Location

use of flash.tools.debugger.Location 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

Location (flash.tools.debugger.Location)21 SourceFile (flash.tools.debugger.SourceFile)15 HashMap (java.util.HashMap)8 InProgressException (flash.tools.debugger.InProgressException)6 NotConnectedException (flash.tools.debugger.NotConnectedException)5 SwfInfo (flash.tools.debugger.SwfInfo)5 Map (java.util.Map)5 PlayerDebugException (flash.tools.debugger.PlayerDebugException)4 DSwfInfo (flash.tools.debugger.concrete.DSwfInfo)4 Frame (flash.tools.debugger.Frame)3 NoResponseException (flash.tools.debugger.NoResponseException)3 ParseException (java.text.ParseException)3 SourceBreakpoint (com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint)2 Breakpoint (com.nextgenactionscript.vscode.debug.responses.Breakpoint)2 Variable (flash.tools.debugger.Variable)2 ArrayList (java.util.ArrayList)2 Source (com.nextgenactionscript.vscode.debug.requests.Source)1 SetBreakpointsResponseBody (com.nextgenactionscript.vscode.debug.responses.SetBreakpointsResponseBody)1 StackFrame (com.nextgenactionscript.vscode.debug.responses.StackFrame)1 StackTraceResponseBody (com.nextgenactionscript.vscode.debug.responses.StackTraceResponseBody)1