Debugger - display variables in the tree structure

Set variables while debugging
This commit is contained in:
Jindra Petřík
2015-12-15 09:48:51 +01:00
parent 2377eef49d
commit 33fdfcc0ac
28 changed files with 2704 additions and 63 deletions

View File

@@ -22,6 +22,7 @@ import com.jpexs.debugger.flash.Debugger;
import com.jpexs.debugger.flash.DebuggerCommands;
import com.jpexs.debugger.flash.DebuggerConnection;
import com.jpexs.debugger.flash.Variable;
import com.jpexs.debugger.flash.VariableType;
import com.jpexs.debugger.flash.messages.in.InAskBreakpoints;
import com.jpexs.debugger.flash.messages.in.InBreakAt;
import com.jpexs.debugger.flash.messages.in.InBreakAtExt;
@@ -108,6 +109,40 @@ public class DebuggerHandler implements DebugConnectionListener {
return breakScriptName;
}
public InGetVariable getVariable(long parentId, String varName, boolean children) {
try {
return commands.getVariable(parentId, varName, true, children);
} catch (IOException ex) {
return null;
}
}
public void setVariable(long parentId, String varName, int valueType, Object value) {
try {
String svalue = "";
switch (valueType) {
case VariableType.STRING:
svalue = "" + value;
break;
case VariableType.NUMBER:
svalue = "" + value;
break;
case VariableType.BOOLEAN:
svalue = ((Boolean) value) ? "true" : "false";
break;
case VariableType.UNDEFINED:
svalue = "undefined";
break;
case VariableType.NULL:
svalue = "undefined";
break;
}
commands.setVariable(parentId, varName, valueType, svalue);
} catch (IOException ex) {
//ignore
}
}
public synchronized void removeBreakPoint(String scriptName, int line) {
if (isBreakpointInvalid(scriptName, line)) {
invalidBreakPointMap.get(scriptName).remove(line);
@@ -332,6 +367,17 @@ public class DebuggerHandler implements DebugConnectionListener {
clisteners.remove(l);
}
public synchronized void refreshFrame() {
if (!paused) {
return;
}
try {
frame = commands.getFrame(0);
} catch (IOException ex) {
//ignore
}
}
public synchronized InFrame getFrame() {
if (!paused) {
return null;