本文整理汇总了Java中org.jf.dexlib2.iface.TryBlock.getCodeUnitCount方法的典型用法代码示例。如果您正苦于以下问题:Java TryBlock.getCodeUnitCount方法的具体用法?Java TryBlock.getCodeUnitCount怎么用?Java TryBlock.getCodeUnitCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jf.dexlib2.iface.TryBlock
的用法示例。
在下文中一共展示了TryBlock.getCodeUnitCount方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: of
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) {
if (tryBlock instanceof ImmutableTryBlock) {
return (ImmutableTryBlock)tryBlock;
}
return new ImmutableTryBlock(
tryBlock.getStartCodeAddress(),
tryBlock.getCodeUnitCount(),
tryBlock.getExceptionHandlers());
}
示例2: equals
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
@Override public boolean equals(Object o) {
if (o instanceof TryBlock) {
TryBlock other = (TryBlock)o;
return getStartCodeAddress() == other.getStartCodeAddress() &&
getCodeUnitCount() == other.getCodeUnitCount() &&
getExceptionHandlers().equals(other.getExceptionHandlers());
}
return false;
}
示例3: massageTryBlocks
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
public static <EH extends ExceptionHandler> List<TryBlock<EH>> massageTryBlocks(
List<? extends TryBlock<? extends EH>> tryBlocks) {
TryListBuilder<EH> tlb = new TryListBuilder<EH>();
for (TryBlock<? extends EH> tryBlock: tryBlocks) {
int startAddress = tryBlock.getStartCodeAddress();
int endAddress = startAddress + tryBlock.getCodeUnitCount();
for (EH exceptionHandler: tryBlock.getExceptionHandlers()) {
tlb.addHandler(startAddress, endAddress, exceptionHandler);
}
}
return tlb.getTryBlocks();
}
示例4: of
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
public static ImmutableTryBlock of(TryBlock<? extends ExceptionHandler> tryBlock) {
if (tryBlock instanceof ImmutableTryBlock) {
return (ImmutableTryBlock) tryBlock;
}
return new ImmutableTryBlock(
tryBlock.getStartCodeAddress(),
tryBlock.getCodeUnitCount(),
tryBlock.getExceptionHandlers());
}
示例5: equals
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
@Override
public boolean equals(Object o) {
if (o instanceof TryBlock) {
TryBlock other = (TryBlock) o;
return getStartCodeAddress() == other.getStartCodeAddress() &&
getCodeUnitCount() == other.getCodeUnitCount() &&
getExceptionHandlers().equals(other.getExceptionHandlers());
}
return false;
}
示例6: massageTryBlocks
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
public static <EH extends ExceptionHandler> List<TryBlock<EH>> massageTryBlocks(
List<? extends TryBlock<? extends EH>> tryBlocks) {
TryListBuilder<EH> tlb = new TryListBuilder<EH>();
for (TryBlock<? extends EH> tryBlock : tryBlocks) {
int startAddress = tryBlock.getStartCodeAddress();
int endAddress = startAddress + tryBlock.getCodeUnitCount();
for (EH exceptionHandler : tryBlock.getExceptionHandlers()) {
tlb.addHandler(startAddress, endAddress, exceptionHandler);
}
}
return tlb.getTryBlocks();
}
示例7: addTraps
import org.jf.dexlib2.iface.TryBlock; //导入方法依赖的package包/类
/**
* Add the traps of this body.
*
* Should only be called at the end jimplify.
*/
private void addTraps() {
for (TryBlock<? extends ExceptionHandler> tryItem : tries) {
int startAddress = tryItem.getStartCodeAddress();
Debug.printDbg(" start : 0x", Integer.toHexString(startAddress));
int length = tryItem.getCodeUnitCount();//.getTryLength();
Debug.printDbg(" length: 0x", Integer.toHexString(length));
Debug.printDbg(" end : 0x", Integer.toHexString(startAddress + length));
int endAddress = startAddress + length;// - 1;
Unit beginStmt = instructionAtAddress(startAddress).getUnit();
// (startAddress + length) typically points to the first byte of the first instruction after the try block
// except if there is no instruction after the try block in which case it points to the last byte of the last
// instruction of the try block. Removing 1 from (startAddress + length) always points to "somewhere" in
// the last instruction of the try block since the smallest instruction is on two bytes (nop = 0x0000).
Unit endStmt = instructionAtAddress (endAddress).getUnit();
// if the try block ends on the last instruction of the body, add a
// nop instruction so Soot can include
// the last instruction in the try block.
if (jBody.getUnits().getLast() == endStmt
&& instructionAtAddress(endAddress - 1).getUnit() == endStmt) {
Unit nop = Jimple.v().newNopStmt();
jBody.getUnits().insertAfter(nop, endStmt);
endStmt = nop;
}
Debug.printDbg("begin instruction (0x",
Integer.toHexString(startAddress), "): ",
instructionAtAddress(startAddress).getUnit(), " --- ",
beginStmt);
Debug.printDbg("end instruction (0x",
Integer.toHexString(endAddress), "): ",
instructionAtAddress(endAddress).getUnit(), " --- ",
endStmt);
List<? extends ExceptionHandler> hList = tryItem.getExceptionHandlers();
for (ExceptionHandler handler: hList) {
int handlerAddress = handler.getHandlerCodeAddress();
Debug.printDbg("handler (0x",
Integer.toHexString(handlerAddress),
"): ",
instructionAtAddress (handlerAddress).getUnit(),
" --- ",
handlerAddress > 0 ? instructionAtAddress (handlerAddress-1).getUnit() : "<unknown>");
String exceptionType = handler.getExceptionType();
if (exceptionType == null)
exceptionType = "Ljava/lang/Throwable;";
Type t = DexType.toSoot(exceptionType);
// exceptions can only be of RefType
if (t instanceof RefType) {
SootClass exception = ((RefType) t).getSootClass();
DexlibAbstractInstruction instruction = instructionAtAddress(handler.getHandlerCodeAddress());
if (! (instruction instanceof MoveExceptionInstruction))
Debug.printDbg("First instruction of trap handler unit not MoveException but " , instruction.getClass());
else
((MoveExceptionInstruction) instruction).setRealType(this, exception.getType());
Trap trap = Jimple.v().newTrap(exception, beginStmt, endStmt, instruction.getUnit());
jBody.getTraps().add(trap);
}
}
}
}