com.android.dx.cf.iface.Member Java Examples

The following examples show how to use com.android.dx.cf.iface.Member. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: BlockDumper.java    From buck with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
        String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    if ((member.getAccessFlags() & (AccessFlags.ACC_ABSTRACT |
            AccessFlags.ACC_NATIVE)) != 0) {
        return;
    }

    ConcreteMethod meth =
        new ConcreteMethod((Method) member, classFile, true, true);

    if (rop) {
        ropDump(meth);
    } else {
        regularDump(meth);
    }
}
 
Example #2
Source File: BlockDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
        String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    if ((member.getAccessFlags() & (AccessFlags.ACC_ABSTRACT |
            AccessFlags.ACC_NATIVE)) != 0) {
        return;
    }

    ConcreteMethod meth =
        new ConcreteMethod((Method) member, classFile, true, true);

    if (rop) {
        ropDump(meth);
    } else {
        regularDump(meth);
    }
}
 
Example #3
Source File: BlockDumper.java    From Box with Apache License 2.0 6 votes vote down vote up
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
        String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    if ((member.getAccessFlags() & (AccessFlags.ACC_ABSTRACT |
            AccessFlags.ACC_NATIVE)) != 0) {
        return;
    }

    ConcreteMethod meth =
        new ConcreteMethod((Method) member, classFile, true, true);

    if (rop) {
        ropDump(meth);
    } else {
        regularDump(meth);
    }
}
 
Example #4
Source File: MethodListParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdMethod meth =
        new StdMethod(getDefiner(), accessFlags, nat, attributes);

    methods.set(n, meth);
    return meth;
}
 
Example #5
Source File: FieldListParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdField field =
        new StdField(getDefiner(), accessFlags, nat, attributes);

    fields.set(n, field);
    return field;
}
 
Example #6
Source File: MethodListParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdMethod meth =
        new StdMethod(getDefiner(), accessFlags, nat, attributes);

    methods.set(n, meth);
    return meth;
}
 
Example #7
Source File: FieldListParser.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdField field =
        new StdField(getDefiner(), accessFlags, nat, attributes);

    fields.set(n, field);
    return field;
}
 
Example #8
Source File: FieldListParser.java    From Box with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdField field =
        new StdField(getDefiner(), accessFlags, nat, attributes);

    fields.set(n, field);
    return field;
}
 
Example #9
Source File: MethodListParser.java    From buck with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdMethod meth =
        new StdMethod(getDefiner(), accessFlags, nat, attributes);

    methods.set(n, meth);
    return meth;
}
 
Example #10
Source File: FieldListParser.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdField field =
        new StdField(getDefiner(), accessFlags, nat, attributes);

    fields.set(n, field);
    return field;
}
 
Example #11
Source File: MethodListParser.java    From J2ME-Loader with Apache License 2.0 5 votes vote down vote up
/** {@inheritDoc} */
@Override
protected Member set(int n, int accessFlags, CstNat nat,
                     AttributeList attributes) {
    StdMethod meth =
        new StdMethod(getDefiner(), accessFlags, nat, attributes);

    methods.set(n, meth);
    return meth;
}
 
Example #12
Source File: DotDumper.java    From buck with Apache License 2.0 4 votes vote down vote up
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    ConcreteMethod meth = new ConcreteMethod((Method) member, classFile,
                                             true, true);

    TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
    RopMethod rmeth =
        Ropper.convert(meth, advice, classFile.getMethods());

    if (optimize) {
        boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags());
        rmeth = Optimizer.optimize(rmeth,
                BaseDumper.computeParamWidth(meth, isStatic), isStatic,
                true, advice);
    }

    System.out.println("digraph "  + name + "{");

    System.out.println("\tfirst -> n"
            + Hex.u2(rmeth.getFirstLabel()) + ";");

    BasicBlockList blocks = rmeth.getBlocks();

    int sz = blocks.size();
    for (int i = 0; i < sz; i++) {
        BasicBlock bb = blocks.get(i);
        int label = bb.getLabel();
        IntList successors = bb.getSuccessors();

        if (successors.size() == 0) {
            System.out.println("\tn" + Hex.u2(label) + " -> returns;");
        } else if (successors.size() == 1) {
            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(successors.get(0)) + ";");
        } else {
            System.out.print("\tn" + Hex.u2(label) + " -> {");
            for (int j = 0; j < successors.size(); j++ ) {
                int successor = successors.get(j);

                if (successor != bb.getPrimarySuccessor()) {
                    System.out.print(" n" + Hex.u2(successor) + " ");
                }

            }
            System.out.println("};");

            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(bb.getPrimarySuccessor())
                    + " [label=\"primary\"];");


        }
    }

    System.out.println("}");
}
 
Example #13
Source File: BaseDumper.java    From buck with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    // This space intentionally left blank.
}
 
Example #14
Source File: DotDumper.java    From Box with Apache License 2.0 4 votes vote down vote up
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    ConcreteMethod meth = new ConcreteMethod((Method) member, classFile,
                                             true, true);

    TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
    RopMethod rmeth =
        Ropper.convert(meth, advice, classFile.getMethods(), dexOptions);

    if (optimize) {
        boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags());
        rmeth = Optimizer.optimize(rmeth,
                BaseDumper.computeParamWidth(meth, isStatic), isStatic,
                true, advice);
    }

    System.out.println("digraph "  + name + "{");

    System.out.println("\tfirst -> n"
            + Hex.u2(rmeth.getFirstLabel()) + ";");

    BasicBlockList blocks = rmeth.getBlocks();

    int sz = blocks.size();
    for (int i = 0; i < sz; i++) {
        BasicBlock bb = blocks.get(i);
        int label = bb.getLabel();
        IntList successors = bb.getSuccessors();

        if (successors.size() == 0) {
            System.out.println("\tn" + Hex.u2(label) + " -> returns;");
        } else if (successors.size() == 1) {
            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(successors.get(0)) + ";");
        } else {
            System.out.print("\tn" + Hex.u2(label) + " -> {");
            for (int j = 0; j < successors.size(); j++ ) {
                int successor = successors.get(j);

                if (successor != bb.getPrimarySuccessor()) {
                    System.out.print(" n" + Hex.u2(successor) + " ");
                }

            }
            System.out.println("};");

            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(bb.getPrimarySuccessor())
                    + " [label=\"primary\"];");


        }
    }

    System.out.println("}");
}
 
Example #15
Source File: BaseDumper.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    // This space intentionally left blank.
}
 
Example #16
Source File: DotDumper.java    From Box with Apache License 2.0 4 votes vote down vote up
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    if (!(member instanceof Method)) {
        return;
    }

    if (!shouldDumpMethod(name)) {
        return;
    }

    ConcreteMethod meth = new ConcreteMethod((Method) member, classFile,
                                             true, true);

    TranslationAdvice advice = DexTranslationAdvice.THE_ONE;
    RopMethod rmeth =
        Ropper.convert(meth, advice, classFile.getMethods(), dexOptions);

    if (optimize) {
        boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags());
        rmeth = Optimizer.optimize(rmeth,
                BaseDumper.computeParamWidth(meth, isStatic), isStatic,
                true, advice);
    }

    System.out.println("digraph "  + name + "{");

    System.out.println("\tfirst -> n"
            + Hex.u2(rmeth.getFirstLabel()) + ";");

    BasicBlockList blocks = rmeth.getBlocks();

    int sz = blocks.size();
    for (int i = 0; i < sz; i++) {
        BasicBlock bb = blocks.get(i);
        int label = bb.getLabel();
        IntList successors = bb.getSuccessors();

        if (successors.size() == 0) {
            System.out.println("\tn" + Hex.u2(label) + " -> returns;");
        } else if (successors.size() == 1) {
            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(successors.get(0)) + ";");
        } else {
            System.out.print("\tn" + Hex.u2(label) + " -> {");
            for (int j = 0; j < successors.size(); j++ ) {
                int successor = successors.get(j);

                if (successor != bb.getPrimarySuccessor()) {
                    System.out.print(" n" + Hex.u2(successor) + " ");
                }

            }
            System.out.println("};");

            System.out.println("\tn" + Hex.u2(label) + " -> n"
                    + Hex.u2(bb.getPrimarySuccessor())
                    + " [label=\"primary\"];");


        }
    }

    System.out.println("}");
}
 
Example #17
Source File: BaseDumper.java    From Box with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public void endParsingMember(ByteArray bytes, int offset, String name,
                             String descriptor, Member member) {
    // This space intentionally left blank.
}
 
Example #18
Source File: MemberListParser.java    From J2ME-Loader with Apache License 2.0 2 votes vote down vote up
/**
 * Sets an element in the list. Subclasses must override this method.
 *
 * @param n which element
 * @param accessFlags the {@code access_flags}
 * @param nat the interpreted name and type (based on the two
 * {@code *_index} fields)
 * @param attributes list of parsed attributes
 * @return {@code non-null;} the constructed member
 */
protected abstract Member set(int n, int accessFlags, CstNat nat,
        AttributeList attributes);
 
Example #19
Source File: MemberListParser.java    From buck with Apache License 2.0 2 votes vote down vote up
/**
 * Sets an element in the list. Subclasses must override this method.
 *
 * @param n which element
 * @param accessFlags the {@code access_flags}
 * @param nat the interpreted name and type (based on the two
 * {@code *_index} fields)
 * @param attributes list of parsed attributes
 * @return {@code non-null;} the constructed member
 */
protected abstract Member set(int n, int accessFlags, CstNat nat,
        AttributeList attributes);
 
Example #20
Source File: MemberListParser.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Sets an element in the list. Subclasses must override this method.
 *
 * @param n which element
 * @param accessFlags the {@code access_flags}
 * @param nat the interpreted name and type (based on the two
 * {@code *_index} fields)
 * @param attributes list of parsed attributes
 * @return {@code non-null;} the constructed member
 */
protected abstract Member set(int n, int accessFlags, CstNat nat,
        AttributeList attributes);
 
Example #21
Source File: MemberListParser.java    From Box with Apache License 2.0 2 votes vote down vote up
/**
 * Sets an element in the list. Subclasses must override this method.
 *
 * @param n which element
 * @param accessFlags the {@code access_flags}
 * @param nat the interpreted name and type (based on the two
 * {@code *_index} fields)
 * @param attributes list of parsed attributes
 * @return {@code non-null;} the constructed member
 */
protected abstract Member set(int n, int accessFlags, CstNat nat,
        AttributeList attributes);