Java Code Examples for org.jf.dexlib2.analysis.RegisterType#writeTo()

The following examples show how to use org.jf.dexlib2.analysis.RegisterType#writeTo() . 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: PostInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        RegisterType registerType = analyzedInstruction.getPostInstructionRegisterType(registerNum);

        registerFormatter.writeTo(writer, registerNum);
        writer.write('=');
        registerType.writeTo(writer);
        writer.write(';');
    }
    return true;
}
 
Example 2
Source File: PostInstructionRegisterInfoMethodItem.java    From atlas with Apache License 2.0 6 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        RegisterType registerType = analyzedInstruction.getPostInstructionRegisterType(registerNum);

        registerFormatter.writeTo(writer, registerNum);
        writer.write('=');
        registerType.writeTo(writer);
        writer.write(';');
    }
    return true;
}
 
Example 3
Source File: PostInstructionRegisterInfoMethodItem.java    From zjdroid with Apache License 2.0 6 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        RegisterType registerType = analyzedInstruction.getPostInstructionRegisterType(registerNum);

        registerFormatter.writeTo(writer, registerNum);
        writer.write('=');
        registerType.writeTo(writer);
        writer.write(';');
    }
    return true;
}
 
Example 4
Source File: PostInstructionRegisterInfoMethodItem.java    From HeyGirl with Apache License 2.0 6 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        RegisterType registerType = analyzedInstruction.getPostInstructionRegisterType(registerNum);

        registerFormatter.writeTo(writer, registerNum);
        writer.write('=');
        registerType.writeTo(writer);
        writer.write(';');
    }
    return true;
}
 
Example 5
Source File: PostInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 6 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers) throws IOException {
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        RegisterType registerType = analyzedInstruction.getPostInstructionRegisterType(registerNum);

        registerFormatter.writeTo(writer, registerNum);
        writer.write('=');
        registerType.writeTo(writer);
        writer.write(';');
    }
    return true;
}
 
Example 6
Source File: PreInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private void writeFullMerge(IndentingWriter writer, int registerNum) throws IOException {
    registerFormatter.writeTo(writer, registerNum);
    writer.write('=');
    analyzedInstruction.getPreInstructionRegisterType(registerNum).writeTo(writer);
    writer.write(":merge{");

    boolean first = true;

    for (AnalyzedInstruction predecessor: analyzedInstruction.getPredecessors()) {
        RegisterType predecessorRegisterType = predecessor.getPostInstructionRegisterType(registerNum);

        if (!first) {
            writer.write(',');
        }

        if (predecessor.getInstructionIndex() == -1) {
            //the fake "StartOfMethod" instruction
            writer.write("Start:");
        } else {
            writer.write("0x");
            writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
            writer.write(':');
        }
        predecessorRegisterType.writeTo(writer);

        first = false;
    }
    writer.write('}');
}
 
Example 7
Source File: PreInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
                                  BitSet fullMergeRegisters) throws IOException {
    boolean firstRegister = true;
    boolean previousWasFullMerge = false;
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        boolean fullMerge = fullMergeRegisters!=null && fullMergeRegisters.get(registerNum);
        if (fullMerge) {
            if (!firstRegister) {
                writer.write('\n');
                writer.write('#');
            }
            writeFullMerge(writer, registerNum);
            previousWasFullMerge = true;
        } else {
            if (previousWasFullMerge) {
                writer.write('\n');
                writer.write('#');
                previousWasFullMerge = false;
            }

            RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(registerNum);

            registerFormatter.writeTo(writer, registerNum);
            writer.write('=');

            registerType.writeTo(writer);
            writer.write(';');
        }

        firstRegister = false;
    }
    return true;
}
 
Example 8
Source File: PreInstructionRegisterInfoMethodItem.java    From atlas with Apache License 2.0 5 votes vote down vote up
private void writeFullMerge(IndentingWriter writer, int registerNum) throws IOException {
    registerFormatter.writeTo(writer, registerNum);
    writer.write('=');
    analyzedInstruction.getPreInstructionRegisterType(registerNum).writeTo(writer);
    writer.write(":merge{");

    boolean first = true;

    for (AnalyzedInstruction predecessor: analyzedInstruction.getPredecessors()) {
        RegisterType predecessorRegisterType = predecessor.getPostInstructionRegisterType(registerNum);

        if (!first) {
            writer.write(',');
        }

        if (predecessor.getInstructionIndex() == -1) {
            //the fake "StartOfMethod" instruction
            writer.write("Start:");
        } else {
            writer.write("0x");
            writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
            writer.write(':');
        }
        predecessorRegisterType.writeTo(writer);

        first = false;
    }
    writer.write('}');
}
 
Example 9
Source File: PreInstructionRegisterInfoMethodItem.java    From atlas with Apache License 2.0 5 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
                                  BitSet fullMergeRegisters) throws IOException {
    boolean firstRegister = true;
    boolean previousWasFullMerge = false;
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        boolean fullMerge = fullMergeRegisters!=null && fullMergeRegisters.get(registerNum);
        if (fullMerge) {
            if (!firstRegister) {
                writer.write('\n');
                writer.write('#');
            }
            writeFullMerge(writer, registerNum);
            previousWasFullMerge = true;
        } else {
            if (previousWasFullMerge) {
                writer.write('\n');
                writer.write('#');
                previousWasFullMerge = false;
            }

            RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(registerNum);

            registerFormatter.writeTo(writer, registerNum);
            writer.write('=');

            registerType.writeTo(writer);
            writer.write(';');
        }

        firstRegister = false;
    }
    return true;
}
 
Example 10
Source File: PreInstructionRegisterInfoMethodItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
private void writeFullMerge(IndentingWriter writer, int registerNum) throws IOException {
    registerFormatter.writeTo(writer, registerNum);
    writer.write('=');
    analyzedInstruction.getPreInstructionRegisterType(registerNum).writeTo(writer);
    writer.write(":merge{");

    boolean first = true;

    for (AnalyzedInstruction predecessor: analyzedInstruction.getPredecessors()) {
        RegisterType predecessorRegisterType = predecessor.getPostInstructionRegisterType(registerNum);

        if (!first) {
            writer.write(',');
        }

        if (predecessor.getInstructionIndex() == -1) {
            //the fake "StartOfMethod" instruction
            writer.write("Start:");
        } else {
            writer.write("0x");
            writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
            writer.write(':');
        }
        predecessorRegisterType.writeTo(writer);

        first = false;
    }
    writer.write('}');
}
 
Example 11
Source File: PreInstructionRegisterInfoMethodItem.java    From zjdroid with Apache License 2.0 5 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
                                  BitSet fullMergeRegisters) throws IOException {
    boolean firstRegister = true;
    boolean previousWasFullMerge = false;
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        boolean fullMerge = fullMergeRegisters!=null && fullMergeRegisters.get(registerNum);
        if (fullMerge) {
            if (!firstRegister) {
                writer.write('\n');
                writer.write('#');
            }
            writeFullMerge(writer, registerNum);
            previousWasFullMerge = true;
        } else {
            if (previousWasFullMerge) {
                writer.write('\n');
                writer.write('#');
                previousWasFullMerge = false;
            }

            RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(registerNum);

            registerFormatter.writeTo(writer, registerNum);
            writer.write('=');

            registerType.writeTo(writer);
            writer.write(';');
        }

        firstRegister = false;
    }
    return true;
}
 
Example 12
Source File: PreInstructionRegisterInfoMethodItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
private void writeFullMerge(IndentingWriter writer, int registerNum) throws IOException {
    registerFormatter.writeTo(writer, registerNum);
    writer.write('=');
    analyzedInstruction.getPreInstructionRegisterType(registerNum).writeTo(writer);
    writer.write(":merge{");

    boolean first = true;

    for (AnalyzedInstruction predecessor: analyzedInstruction.getPredecessors()) {
        RegisterType predecessorRegisterType = predecessor.getPostInstructionRegisterType(registerNum);

        if (!first) {
            writer.write(',');
        }

        if (predecessor.getInstructionIndex() == -1) {
            //the fake "StartOfMethod" instruction
            writer.write("Start:");
        } else {
            writer.write("0x");
            writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
            writer.write(':');
        }
        predecessorRegisterType.writeTo(writer);

        first = false;
    }
    writer.write('}');
}
 
Example 13
Source File: PreInstructionRegisterInfoMethodItem.java    From HeyGirl with Apache License 2.0 5 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
                                  BitSet fullMergeRegisters) throws IOException {
    boolean firstRegister = true;
    boolean previousWasFullMerge = false;
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        boolean fullMerge = fullMergeRegisters!=null && fullMergeRegisters.get(registerNum);
        if (fullMerge) {
            if (!firstRegister) {
                writer.write('\n');
                writer.write('#');
            }
            writeFullMerge(writer, registerNum);
            previousWasFullMerge = true;
        } else {
            if (previousWasFullMerge) {
                writer.write('\n');
                writer.write('#');
                previousWasFullMerge = false;
            }

            RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(registerNum);

            registerFormatter.writeTo(writer, registerNum);
            writer.write('=');

            registerType.writeTo(writer);
            writer.write(';');
        }

        firstRegister = false;
    }
    return true;
}
 
Example 14
Source File: PreInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private void writeFullMerge(IndentingWriter writer, int registerNum) throws IOException {
    registerFormatter.writeTo(writer, registerNum);
    writer.write('=');
    analyzedInstruction.getPreInstructionRegisterType(registerNum).writeTo(writer);
    writer.write(":merge{");

    boolean first = true;

    for (AnalyzedInstruction predecessor: analyzedInstruction.getPredecessors()) {
        RegisterType predecessorRegisterType = predecessor.getPostInstructionRegisterType(registerNum);

        if (!first) {
            writer.write(',');
        }

        if (predecessor.getInstructionIndex() == -1) {
            //the fake "StartOfMethod" instruction
            writer.write("Start:");
        } else {
            writer.write("0x");
            writer.printUnsignedLongAsHex(methodAnalyzer.getInstructionAddress(predecessor));
            writer.write(':');
        }
        predecessorRegisterType.writeTo(writer);

        first = false;
    }
    writer.write('}');
}
 
Example 15
Source File: PreInstructionRegisterInfoMethodItem.java    From ZjDroid with Apache License 2.0 5 votes vote down vote up
private boolean writeRegisterInfo(IndentingWriter writer, BitSet registers,
                                  BitSet fullMergeRegisters) throws IOException {
    boolean firstRegister = true;
    boolean previousWasFullMerge = false;
    int registerNum = registers.nextSetBit(0);
    if (registerNum < 0) {
        return false;
    }

    writer.write('#');
    for (; registerNum >= 0; registerNum = registers.nextSetBit(registerNum + 1)) {
        boolean fullMerge = fullMergeRegisters!=null && fullMergeRegisters.get(registerNum);
        if (fullMerge) {
            if (!firstRegister) {
                writer.write('\n');
                writer.write('#');
            }
            writeFullMerge(writer, registerNum);
            previousWasFullMerge = true;
        } else {
            if (previousWasFullMerge) {
                writer.write('\n');
                writer.write('#');
                previousWasFullMerge = false;
            }

            RegisterType registerType = analyzedInstruction.getPreInstructionRegisterType(registerNum);

            registerFormatter.writeTo(writer, registerNum);
            writer.write('=');

            registerType.writeTo(writer);
            writer.write(';');
        }

        firstRegister = false;
    }
    return true;
}