Esempio n. 1
0
  @Override
  public void visitCode() {
    AsmUtil.PUSH(mv, fullname_hash);
    mv.visitLdcInsn(fullname);

    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, START_METHOD, START_SIGNATURE, false);

    statIdx = newLocal(Type.getType(Object.class));

    mv.visitVarInsn(Opcodes.ASTORE, statIdx);
    mv.visitLabel(startFinally);
    mv.visitCode();
  }
Esempio n. 2
0
  @Override
  public MethodVisitor visitMethod(
      int access, String name, String desc, String signature, String[] exceptions) {
    MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions);
    if (mv == null || mset.isA(name, desc) == false) {
      return mv;
    }
    if (AsmUtil.isSpecial(name)) {
      return mv;
    }

    Configure conf = Configure.getInstance();
    boolean isPublic = conf.hook_method_access_public;
    boolean isProtected = conf.hook_method_access_protected;
    boolean isPrivate = conf.hook_method_access_private;
    boolean isNone = conf.hook_method_access_none;
    switch (access & (Opcodes.ACC_PUBLIC | Opcodes.ACC_PROTECTED | Opcodes.ACC_PRIVATE)) {
      case Opcodes.ACC_PUBLIC:
        if (isPublic == false) return mv;
        break;
      case Opcodes.ACC_PROTECTED:
        if (isProtected == false) return mv;
        break;
      case Opcodes.ACC_PRIVATE:
        if (isPrivate == false) return mv;
        break;
      default:
        if (isNone == false) return mv;
        break;
    }
    // check prefix, to ignore simple method such as getter,setter
    if (conf.isIgnoreMethodPrefix(name)) return mv;

    String fullname = AsmUtil.add(className, name, desc);
    int fullname_hash = DataProxy.sendMethodName(fullname);

    return new MethodMV(access, desc, mv, fullname, fullname_hash);
  }
Esempio n. 3
0
  @Override
  public void visitCode() {

    AsmUtil.PUSH(mv, methodName);

    boolean flag = false;
    int sidx = isStatic ? 0 : 1;
    for (int i = 0; i < paramTypes.length; i++) {
      Type tp = paramTypes[i];
      if ("java/lang/String".equals(tp.getInternalName())) {
        mv.visitVarInsn(Opcodes.ALOAD, sidx);
        flag = true;
        break;
      }
      sidx += tp.getSize();
    }

    if (flag == false) {
      AsmUtil.PUSH(mv, "");
    }
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, CLASS, METHOD, SIGNATURE, false);
    super.visitCode();
  }