Search in sources :

Example 1 with Opcode

use of jadx.api.plugins.input.insns.Opcode in project jadx by skylot.

the class Smali method fmtPayloadInsn.

private boolean fmtPayloadInsn(InsnData insn, LineInfo line) {
    Opcode opcode = insn.getOpcode();
    if (opcode == PACKED_SWITCH_PAYLOAD) {
        line.getLineWriter().append("packed-switch-payload");
        line.addInsnLine(insn.getOffset(), line.getLineWriter().toString());
        ISwitchPayload payload = (ISwitchPayload) insn.getPayload();
        if (payload != null) {
            fmtSwitchPayload(insn, FMT_P_SWITCH_CASE, FMT_P_SWITCH_CASE_TAG, line, payload, insn.getOffset());
        }
        return true;
    }
    if (opcode == SPARSE_SWITCH_PAYLOAD) {
        line.getLineWriter().append("sparse-switch-payload");
        line.addInsnLine(insn.getOffset(), line.getLineWriter().toString());
        ISwitchPayload payload = (ISwitchPayload) insn.getPayload();
        if (payload != null) {
            fmtSwitchPayload(insn, FMT_S_SWITCH_CASE, FMT_S_SWITCH_CASE_TAG, line, payload, insn.getOffset());
        }
        return true;
    }
    if (opcode == FILL_ARRAY_DATA_PAYLOAD) {
        line.getLineWriter().append("fill-array-data-payload");
        line.addInsnLine(insn.getOffset(), line.getLineWriter().toString());
        return true;
    }
    return false;
}
Also used : ISwitchPayload(jadx.api.plugins.input.insns.custom.ISwitchPayload) Opcode(jadx.api.plugins.input.insns.Opcode)

Example 2 with Opcode

use of jadx.api.plugins.input.insns.Opcode in project jadx by skylot.

the class Smali method method.

private static String method(InsnData insn) {
    Opcode op = insn.getOpcode();
    if (op == INVOKE_CUSTOM || op == INVOKE_CUSTOM_RANGE) {
        insn.getIndexAsCallSite().load();
        return String.format("%s # call_site@%04x", insn.getIndexAsCallSite().toString(), insn.getIndex());
    }
    IMethodRef mthRef = insn.getIndexAsMethod();
    mthRef.load();
    if (op == INVOKE_POLYMORPHIC || op == INVOKE_POLYMORPHIC_RANGE) {
        return String.format("%s, %s # method@%04x, proto@%04x", mthRef.toString(), insn.getIndexAsProto(insn.getTarget()).toString(), insn.getIndex(), insn.getTarget());
    }
    return String.format("%s # method@%04x", mthRef.toString(), insn.getIndex());
}
Also used : Opcode(jadx.api.plugins.input.insns.Opcode) IMethodRef(jadx.api.plugins.input.data.IMethodRef)

Aggregations

Opcode (jadx.api.plugins.input.insns.Opcode)2 IMethodRef (jadx.api.plugins.input.data.IMethodRef)1 ISwitchPayload (jadx.api.plugins.input.insns.custom.ISwitchPayload)1