Class InsnUtils

java.lang.Object
jadx.core.utils.InsnUtils

public class InsnUtils extends Object
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
  • Constructor Details

    • InsnUtils

      private InsnUtils()
  • Method Details

    • formatOffset

      public static String formatOffset(int offset)
    • insnTypeToString

      public static String insnTypeToString(InsnType type)
    • indexToString

      public static String indexToString(Object index)
    • getConstValueByArg

      public static Object getConstValueByArg(RootNode root, InsnArg arg)
      Search constant assigned to provided arg.
      Returns:
      LiteralArg, String, ArgType or null
    • getConstValueByInsn

      @Nullable public static @Nullable Object getConstValueByInsn(RootNode root, InsnNode insn)
      Return constant value from insn or null if not constant.
      Returns:
      LiteralArg, String, ArgType or null
    • searchSingleReturnInsn

      @Nullable public static @Nullable InsnNode searchSingleReturnInsn(MethodNode mth, Predicate<InsnNode> test)
    • searchInsn

      @Nullable public static @Nullable InsnNode searchInsn(MethodNode mth, InsnType insnType, Predicate<InsnNode> test)
      Search instruction of specific type and condition in method. This method support inlined instructions.
    • replaceInsns

      public static void replaceInsns(MethodNode mth, Function<InsnNode,InsnNode> replaceFunction)
    • replaceInsnsInInsn

      public static void replaceInsnsInInsn(MethodNode mth, InsnNode insn, Function<InsnNode,InsnNode> replaceFunction)
    • getRegFromInsn

      @Nullable public static @Nullable RegisterArg getRegFromInsn(List<RegisterArg> regs, InsnType insnType)
    • recursiveInsnCheck

      private static InsnNode recursiveInsnCheck(InsnNode insn, InsnType insnType, Predicate<InsnNode> test)
    • getSingleArg

      @Nullable public static @Nullable InsnArg getSingleArg(InsnNode insn)
    • checkInsnType

      @Nullable public static @Nullable InsnNode checkInsnType(@Nullable @Nullable InsnNode insn, InsnType insnType)
    • isInsnType

      public static boolean isInsnType(@Nullable @Nullable InsnNode insn, InsnType insnType)
    • getWrappedInsn

      @Nullable public static @Nullable InsnNode getWrappedInsn(InsnArg arg)
    • isWrapped

      public static boolean isWrapped(InsnArg arg, InsnType insnType)
    • dontGenerateIfNotUsed

      public static boolean dontGenerateIfNotUsed(InsnNode insn)
    • containsVar

      public static <T extends InsnArg> boolean containsVar(List<T> list, RegisterArg arg)
    • containsVar

      public static boolean containsVar(InsnNode insn, RegisterArg arg)
    • containsVar

      public static boolean containsVar(InsnArg insnArg, RegisterArg arg)
    • contains

      public static boolean contains(InsnNode insn, AFlag flag)