use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class DebugInfoParser method addrChange.
private int addrChange(int addr, int addrInc, int line) {
int newAddr = addr + addrInc;
int maxAddr = insnByOffset.length - 1;
newAddr = Math.min(newAddr, maxAddr);
for (int i = addr + 1; i <= newAddr; i++) {
InsnNode insn = insnByOffset[i];
if (insn == null) {
continue;
}
for (InsnArg arg : insn.getArguments()) {
if (arg.isRegister()) {
activeRegisters[((RegisterArg) arg).getRegNum()] = arg;
}
}
RegisterArg res = insn.getResult();
if (res != null) {
activeRegisters[res.getRegNum()] = res;
}
}
setSourceLines(addr, newAddr, line);
return newAddr;
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class DebugInfoParser method setVar.
private void setVar(LocalVar var) {
int start = var.getStartAddr();
int end = var.getEndAddr();
for (int i = start; i <= end; i++) {
InsnNode insn = insnByOffset[i];
if (insn != null) {
fillLocals(insn, var);
}
}
merge(activeRegisters[var.getRegNum()], var);
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class DebugInfoParser method startVar.
private void startVar(LocalVar var, int addr, int line) {
int regNum = var.getRegNum();
LocalVar prev = locals[regNum];
if (prev != null && !prev.isEnd()) {
prev.end(addr, line);
setVar(prev);
}
InsnArg activeReg = activeRegisters[var.getRegNum()];
if (activeReg instanceof RegisterArg) {
SSAVar ssaVar = ((RegisterArg) activeReg).getSVar();
if (ssaVar != null && ssaVar.getStartAddr() != -1) {
InsnNode parentInsn = ssaVar.getAssign().getParentInsn();
if (parentInsn != null && parentInsn.getOffset() >= 0) {
addr = parentInsn.getOffset();
}
}
}
var.start(addr, line);
locals[regNum] = var;
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class ConditionGen method isArgWrapNeeded.
private static boolean isArgWrapNeeded(InsnArg arg) {
if (!arg.isInsnWrap()) {
return false;
}
InsnNode insn = ((InsnWrapArg) arg).getWrapInsn();
InsnType insnType = insn.getType();
if (insnType == InsnType.ARITH) {
switch(((ArithNode) insn).getOp()) {
case ADD:
case SUB:
case MUL:
case DIV:
case REM:
return false;
}
} else {
switch(insnType) {
case INVOKE:
case SGET:
case IGET:
case AGET:
case CONST:
case ARRAY_LENGTH:
return false;
default:
return true;
}
}
return true;
}
use of jadx.core.dex.nodes.InsnNode in project jadx by skylot.
the class IfCondition method simplifyCmpOp.
private static void simplifyCmpOp(Compare c) {
if (!c.getA().isInsnWrap()) {
return;
}
if (!c.getB().isLiteral() || ((LiteralArg) c.getB()).getLiteral() != 0) {
return;
}
InsnNode wrapInsn = ((InsnWrapArg) c.getA()).getWrapInsn();
InsnType type = wrapInsn.getType();
if (type != InsnType.CMP_L && type != InsnType.CMP_G) {
return;
}
IfNode insn = c.getInsn();
insn.changeCondition(insn.getOp(), wrapInsn.getArg(0), wrapInsn.getArg(1));
}
Aggregations