com.android.dx.cf.code.BytecodeArray Java Examples
The following examples show how to use
com.android.dx.cf.code.BytecodeArray.
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 Box with Apache License 2.0 | 4 votes |
/** * Does a registerizing dump. * * @param meth {@code non-null;} method data to dump */ private void ropDump(ConcreteMethod meth) { TranslationAdvice advice = DexTranslationAdvice.THE_ONE; BytecodeArray code = meth.getCode(); ByteArray bytes = code.getBytes(); RopMethod rmeth = Ropper.convert(meth, advice, classFile.getMethods(), dexOptions); StringBuilder sb = new StringBuilder(2000); if (optimize) { boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags()); int paramWidth = computeParamWidth(meth, isStatic); rmeth = Optimizer.optimize(rmeth, paramWidth, isStatic, true, advice); } BasicBlockList blocks = rmeth.getBlocks(); int[] order = blocks.getLabelsInOrder(); sb.append("first " + Hex.u2(rmeth.getFirstLabel()) + "\n"); for (int label : order) { BasicBlock bb = blocks.get(blocks.indexOfLabel(label)); sb.append("block "); sb.append(Hex.u2(label)); sb.append("\n"); IntList preds = rmeth.labelToPredecessors(label); int psz = preds.size(); for (int i = 0; i < psz; i++) { sb.append(" pred "); sb.append(Hex.u2(preds.get(i))); sb.append("\n"); } InsnList il = bb.getInsns(); int ilsz = il.size(); for (int i = 0; i < ilsz; i++) { Insn one = il.get(i); sb.append(" "); sb.append(il.get(i).toHuman()); sb.append("\n"); } IntList successors = bb.getSuccessors(); int ssz = successors.size(); if (ssz == 0) { sb.append(" returns\n"); } else { int primary = bb.getPrimarySuccessor(); for (int i = 0; i < ssz; i++) { int succ = successors.get(i); sb.append(" next "); sb.append(Hex.u2(succ)); if ((ssz != 1) && (succ == primary)) { sb.append(" *"); } sb.append("\n"); } } } suppressDump = false; parsed(bytes, 0, bytes.size(), sb.toString()); suppressDump = true; }
Example #2
Source File: BlockDumper.java From Box with Apache License 2.0 | 4 votes |
/** * Does a registerizing dump. * * @param meth {@code non-null;} method data to dump */ private void ropDump(ConcreteMethod meth) { TranslationAdvice advice = DexTranslationAdvice.THE_ONE; BytecodeArray code = meth.getCode(); ByteArray bytes = code.getBytes(); RopMethod rmeth = Ropper.convert(meth, advice, classFile.getMethods(), dexOptions); StringBuilder sb = new StringBuilder(2000); if (optimize) { boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags()); int paramWidth = computeParamWidth(meth, isStatic); rmeth = Optimizer.optimize(rmeth, paramWidth, isStatic, true, advice); } BasicBlockList blocks = rmeth.getBlocks(); int[] order = blocks.getLabelsInOrder(); sb.append("first " + Hex.u2(rmeth.getFirstLabel()) + "\n"); for (int label : order) { BasicBlock bb = blocks.get(blocks.indexOfLabel(label)); sb.append("block "); sb.append(Hex.u2(label)); sb.append("\n"); IntList preds = rmeth.labelToPredecessors(label); int psz = preds.size(); for (int i = 0; i < psz; i++) { sb.append(" pred "); sb.append(Hex.u2(preds.get(i))); sb.append("\n"); } InsnList il = bb.getInsns(); int ilsz = il.size(); for (int i = 0; i < ilsz; i++) { Insn one = il.get(i); sb.append(" "); sb.append(il.get(i).toHuman()); sb.append("\n"); } IntList successors = bb.getSuccessors(); int ssz = successors.size(); if (ssz == 0) { sb.append(" returns\n"); } else { int primary = bb.getPrimarySuccessor(); for (int i = 0; i < ssz; i++) { int succ = successors.get(i); sb.append(" next "); sb.append(Hex.u2(succ)); if ((ssz != 1) && (succ == primary)) { sb.append(" *"); } sb.append("\n"); } } } suppressDump = false; parsed(bytes, 0, bytes.size(), sb.toString()); suppressDump = true; }
Example #3
Source File: BlockDumper.java From buck with Apache License 2.0 | 4 votes |
/** * Does a registerizing dump. * * @param meth {@code non-null;} method data to dump */ private void ropDump(ConcreteMethod meth) { TranslationAdvice advice = DexTranslationAdvice.THE_ONE; BytecodeArray code = meth.getCode(); ByteArray bytes = code.getBytes(); RopMethod rmeth = Ropper.convert(meth, advice, classFile.getMethods()); StringBuffer sb = new StringBuffer(2000); if (optimize) { boolean isStatic = AccessFlags.isStatic(meth.getAccessFlags()); int paramWidth = computeParamWidth(meth, isStatic); rmeth = Optimizer.optimize(rmeth, paramWidth, isStatic, true, advice); } BasicBlockList blocks = rmeth.getBlocks(); int[] order = blocks.getLabelsInOrder(); sb.append("first " + Hex.u2(rmeth.getFirstLabel()) + "\n"); for (int label : order) { BasicBlock bb = blocks.get(blocks.indexOfLabel(label)); sb.append("block "); sb.append(Hex.u2(label)); sb.append("\n"); IntList preds = rmeth.labelToPredecessors(label); int psz = preds.size(); for (int i = 0; i < psz; i++) { sb.append(" pred "); sb.append(Hex.u2(preds.get(i))); sb.append("\n"); } InsnList il = bb.getInsns(); int ilsz = il.size(); for (int i = 0; i < ilsz; i++) { Insn one = il.get(i); sb.append(" "); sb.append(il.get(i).toHuman()); sb.append("\n"); } IntList successors = bb.getSuccessors(); int ssz = successors.size(); if (ssz == 0) { sb.append(" returns\n"); } else { int primary = bb.getPrimarySuccessor(); for (int i = 0; i < ssz; i++) { int succ = successors.get(i); sb.append(" next "); sb.append(Hex.u2(succ)); if ((ssz != 1) && (succ == primary)) { sb.append(" *"); } sb.append("\n"); } } } suppressDump = false; setAt(bytes, 0); parsed(bytes, 0, bytes.size(), sb.toString()); suppressDump = true; }
Example #4
Source File: AttCode.java From Box with Apache License 2.0 | 2 votes |
/** * Gets the bytecode array. * * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return code; }
Example #5
Source File: AttCode.java From Box with Apache License 2.0 | 2 votes |
/** * Gets the bytecode array. * * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return code; }
Example #6
Source File: AttCode.java From J2ME-Loader with Apache License 2.0 | 2 votes |
/** * Gets the bytecode array. * * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return code; }
Example #7
Source File: AttCode.java From buck with Apache License 2.0 | 2 votes |
/** * Gets the bytecode array. * * @return {@code non-null;} the bytecode array */ public BytecodeArray getCode() { return code; }