Correct browsing variables

Show scope, trait, flags of the variables
Add watch
Stub for exporting ByteArray
This commit is contained in:
Jindra Petřík
2016-09-04 23:20:38 +02:00
parent d2f7b6f73b
commit 4331548f92
3 changed files with 374 additions and 134 deletions
@@ -19,6 +19,8 @@ package com.jpexs.decompiler.flash.gui;
import com.jpexs.debugger.flash.Debugger;
import com.jpexs.debugger.flash.DebuggerCommands;
import com.jpexs.debugger.flash.Variable;
import com.jpexs.debugger.flash.VariableType;
import com.jpexs.debugger.flash.messages.in.InCallFunction;
import com.jpexs.decompiler.flash.ApplicationInfo;
import com.jpexs.decompiler.flash.EventListener;
import com.jpexs.decompiler.flash.SWF;
@@ -206,6 +208,29 @@ public class Main {
return runProcess != null && !runProcessDebug;
}
/**
* FIXME!
*
* @param v
*/
public static synchronized void dumpBytes(Variable v) {
InCallFunction icf;
try {
long objectId = 0l;
if ((v.vType == VariableType.OBJECT || v.vType == VariableType.MOVIECLIP)) {
objectId = (Long) v.value;
}
Object oldPos = getDebugHandler().getVariable(objectId, "position", true).parent.value;
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, 0);
icf = getDebugHandler().callFunction(false, "readUTF", v, new ArrayList<>());
System.out.println("Result=" + icf.variables.get(0).value);
getDebugHandler().setVariable(objectId, "position", VariableType.NUMBER, oldPos);
} catch (DebuggerHandler.ActionScriptException ex) {
Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static synchronized boolean addWatch(Variable v, long v_id, boolean watchRead, boolean watchWrite) {
DebuggerCommands.Watch w = getDebugHandler().addWatch(v, v_id, watchRead, watchWrite);
return w != null;