use of jadx.gui.device.debugger.SmaliDebugger.RuntimeType in project jadx by skylot.
the class DebugController method updateRegister.
public boolean updateRegister(RegTreeNode regNode, RuntimeType type, boolean retry) {
if (type == null) {
if (regNode.isAbsoluteType()) {
type = castType(regNode.getType());
} else {
type = POSSIBLE_TYPES[0];
}
}
boolean ok = false;
RuntimeRegister register = null;
try {
register = debugger.getRegisterSync(cur.frame.getThreadID(), cur.frame.getFrame().getID(), regNode.getRuntimeRegNum(), type);
} catch (SmaliDebuggerException e) {
if (retry) {
if (debugger.errIsTypeMismatched(e.getErrCode())) {
RuntimeType[] types = getPossibleTypes(type);
for (RuntimeType nextType : types) {
ok = updateRegister(regNode, nextType, false);
if (ok) {
regNode.updateType(nextType.getDesc());
break;
}
}
} else {
logErr(e.getMessage() + " for " + regNode.getName());
regNode.updateType(null);
regNode.updateValue(null);
}
}
}
if (register != null) {
regNode.updateReg(register);
decodeRuntimeValue(regNode);
}
debuggerPanel.updateRegTree(regNode);
return ok;
}
use of jadx.gui.device.debugger.SmaliDebugger.RuntimeType in project jadx by skylot.
the class DebugController method decodeRuntimeValue.
private boolean decodeRuntimeValue(RuntimeValueTreeNode valNode) {
RuntimeValue rValue = valNode.getRuntimeValue();
RuntimeType type = rValue.getType();
if (!valNode.isAbsoluteType()) {
valNode.updateType(null);
}
try {
switch(type) {
case OBJECT:
return decodeObject(valNode);
case STRING:
String str = "\"" + debugger.readStringSync(rValue) + "\"";
valNode.updateType("java.lang.String").updateTypeID(debugger.readID(rValue)).updateValue(str);
break;
case INT:
valNode.updateValue(Integer.toString(debugger.readInt(rValue)));
break;
case LONG:
valNode.updateValue(Long.toString(debugger.readAll(rValue)));
break;
case ARRAY:
decodeArrayVal(valNode);
break;
case BOOLEAN:
{
int b = debugger.readByte(rValue);
valNode.updateValue(b == 1 ? "true" : "false");
break;
}
case SHORT:
valNode.updateValue(Short.toString(debugger.readShort(rValue)));
break;
case CHAR:
case BYTE:
{
int b = (int) debugger.readAll(rValue);
if (DbgUtils.isPrintableChar(b)) {
valNode.updateValue(type == RuntimeType.CHAR ? String.valueOf((char) b) : String.valueOf((byte) b));
} else {
valNode.updateValue(String.valueOf(b));
}
break;
}
case DOUBLE:
double d = debugger.readDouble(rValue);
valNode.updateValue(Double.toString(d));
break;
case FLOAT:
float f = debugger.readFloat(rValue);
valNode.updateValue(Float.toString(f));
break;
case VOID:
valNode.updateType("void");
break;
case THREAD:
valNode.updateType("thread").updateTypeID(debugger.readID(rValue));
break;
case THREAD_GROUP:
valNode.updateType("thread_group").updateTypeID(debugger.readID(rValue));
break;
case CLASS_LOADER:
valNode.updateType("class_loader").updateTypeID(debugger.readID(rValue));
break;
case CLASS_OBJECT:
valNode.updateType("class_object").updateTypeID(debugger.readID(rValue));
break;
}
} catch (SmaliDebuggerException e) {
logErr(e);
return false;
}
return true;
}
Aggregations