use of flash.tools.debugger.Value in project intellij-plugins by JetBrains.
the class DebugCLI method handleFault.
/**
* We have received a fault and are possibly suspended at this point.
* We need to look at our fault table and determine what do.
* @return true if we resumed execution
*/
boolean handleFault(FaultEvent e) {
// lookup what we need to do
boolean requestResume = false;
String name = e.name();
boolean stop = true;
boolean print = true;
try {
//$NON-NLS-1$
print = m_faultTable.is(name, "print");
//$NON-NLS-1$
stop = m_faultTable.is(name, "stop");
} catch (NullPointerException npe) {
if (Trace.error) {
Map<String, Object> args = new HashMap<String, Object>();
//$NON-NLS-1$
args.put("faultName", name);
//$NON-NLS-1$
Trace.trace(getLocalizationManager().getLocalizedTextString("faultHasNoTableEntry", args));
npe.printStackTrace();
}
}
if (e instanceof ExceptionFault) {
ExceptionFault ef = (ExceptionFault) e;
Value thrownValue = ef.getThrownValue();
if (thrownValue != null) {
if (!ef.willExceptionBeCaught()) {
stop = true;
} else {
stop = false;
String typeName = thrownValue.getTypeName();
int at = typeName.indexOf('@');
if (at != -1)
typeName = typeName.substring(0, at);
for (int i = 0; i < catchpointCount(); ++i) {
CatchAction c = catchpointAt(i);
String typeToCatch = c.getTypeToCatch();
try {
if (typeToCatch == null || getSession().evalIs(thrownValue, typeToCatch)) {
stop = true;
break;
}
} catch (PlayerDebugException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
stop = true;
} catch (PlayerFaultException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
stop = true;
}
}
if (!stop)
print = false;
}
}
}
// should we stop?
if (!stop)
requestResume = true;
if (print)
dumpFaultLine(e);
return requestResume;
}
use of flash.tools.debugger.Value in project intellij-plugins by JetBrains.
the class ExpressionCache method appendVariableValue.
/**
* Given any arbitrary constant value, such as a Double, a String, etc.,
* format its value appropriately. For example, strings will be quoted.
*
* @param sb
* a StringBuilder to which the formatted value will be appended.
* @param o
* the value to format.
*/
public static void appendVariableValue(StringBuilder sb, final Object o) {
Value v;
if (o instanceof Value) {
v = (Value) o;
} else {
v = new Value() {
public int getAttributes() {
return 0;
}
public String[] getClassHierarchy(boolean allLevels) {
return new String[0];
}
public String getClassName() {
//$NON-NLS-1$
return "";
}
public long getId() {
return UNKNOWN_ID;
}
public int getMemberCount(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException {
return 0;
}
public Variable getMemberNamed(Session s, String name) throws NotSuspendedException, NoResponseException, NotConnectedException {
return null;
}
public Variable[] getMembers(Session s) throws NotSuspendedException, NoResponseException, NotConnectedException {
return new Variable[0];
}
public int getType() {
if (o instanceof Number)
return VariableType.NUMBER;
else if (o instanceof Boolean)
return VariableType.BOOLEAN;
else if (o instanceof String)
return VariableType.STRING;
else if (o == Value.UNDEFINED)
return VariableType.UNDEFINED;
else if (o == null)
return VariableType.NULL;
assert false;
return VariableType.UNKNOWN;
}
public String getTypeName() {
//$NON-NLS-1$
return "";
}
public Object getValueAsObject() {
return o;
}
public String getValueAsString() {
return DValue.getValueAsString(o);
}
public boolean isAttributeSet(int variableAttribute) {
return false;
}
public Variable[] getPrivateInheritedMembers() {
return new Variable[0];
}
public Variable[] getPrivateInheritedMemberNamed(String name) {
return new Variable[0];
}
};
}
appendVariableValue(sb, v);
}
use of flash.tools.debugger.Value in project intellij-plugins by JetBrains.
the class DebugCLI method dumpTree.
/**
* Traverse the given variables dumping any Movieclips we find that
* contain a member called 'member'
* @throws NotConnectedException
* @throws NoResponseException
* @throws NotSuspendedException
*/
void dumpTree(Map<Object, String> tree, List<Object> e, String name, Value result, String member) throws NotSuspendedException, NoResponseException, NotConnectedException {
// name for this variable
if (name == null)
//$NON-NLS-1$
name = "";
// have we seen it already
if (tree.containsKey(result))
return;
// place it
tree.put(result, name);
// first iterate over our members looking for 'member'
Value proto = result;
boolean done = false;
while (!done && proto != null) {
Variable[] members = proto.getMembers(m_session);
proto = null;
// see if we find one called 'member'
for (int i = 0; i < members.length; i++) {
Variable m = members[i];
String memName = m.getName();
if (memName.equals(member) && !tree.containsKey(m)) {
e.add(name);
e.add(result);
e.add(m);
//$NON-NLS-1$
tree.put(m, name + "." + memName);
done = true;
} else if (//$NON-NLS-1$
memName.equals("__proto__"))
proto = members[i].getValue();
}
}
// now traverse other mcs recursively
done = false;
proto = result;
while (!done && proto != null) {
Variable[] members = proto.getMembers(m_session);
proto = null;
// see if we find an mc
for (int i = 0; i < members.length; i++) {
Variable m = members[i];
String memName = m.getName();
// if our type is NOT object or movieclip then we are done
if (m.getValue().getType() != VariableType.OBJECT && m.getValue().getType() != VariableType.MOVIECLIP)
;
else if (m.getValue().getId() != Value.UNKNOWN_ID)
dumpTree(tree, e, name, m.getValue(), member);
else if (//$NON-NLS-1$
memName.equals("__proto__")) {
proto = m.getValue();
// name = name + ".__proto__";
}
}
}
}
use of flash.tools.debugger.Value in project intellij-plugins by JetBrains.
the class DebugCLI method dumpTree.
/**
* Traverse the given variables dumping any Movieclips we find that
* contain a member called 'member'
* @throws NotConnectedException
* @throws NoResponseException
* @throws NotSuspendedException
*/
void dumpTree(Map tree, List e, String name, Value result, String member) throws NotSuspendedException, NoResponseException, NotConnectedException {
// name for this variable
if (name == null)
//$NON-NLS-1$
name = "";
// have we seen it already
if (tree.containsKey(result))
return;
// place it
tree.put(result, name);
// first iterate over our members looking for 'member'
Value proto = result;
boolean done = false;
while (!done && proto != null) {
Variable[] members = proto.getMembers(m_session);
proto = null;
// see if we find one called 'member'
for (int i = 0; i < members.length; i++) {
Variable m = members[i];
String memName = m.getName();
if (memName.equals(member) && !tree.containsKey(m)) {
e.add(name);
e.add(result);
e.add(m);
//$NON-NLS-1$
tree.put(m, name + "." + memName);
done = true;
} else if (//$NON-NLS-1$
memName.equals("__proto__"))
proto = members[i].getValue();
}
}
// now traverse other mcs recursively
done = false;
proto = result;
while (!done && proto != null) {
Variable[] members = proto.getMembers(m_session);
proto = null;
// see if we find an mc
for (int i = 0; i < members.length; i++) {
Variable m = members[i];
String memName = m.getName();
// if our type is NOT object or movieclip then we are done
if (m.getValue().getType() != VariableType.OBJECT && m.getValue().getType() != VariableType.MOVIECLIP)
;
else if (m.getValue().getId() != Value.UNKNOWN_ID)
dumpTree(tree, e, name, m.getValue(), member);
else if (//$NON-NLS-1$
memName.equals("__proto__")) {
proto = m.getValue();
// name = name + ".__proto__";
}
}
}
}
Aggregations