当前位置: 首页>>代码示例>>Java>>正文


Java TryBlock.getCodeUnitCount方法代码示例

本文整理汇总了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());
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:10,代码来源:ImmutableTryBlock.java

示例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;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:10,代码来源:BaseTryBlock.java

示例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();
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:15,代码来源:TryListBuilder.java

示例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());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:10,代码来源:ImmutableTryBlock.java

示例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;
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:11,代码来源:BaseTryBlock.java

示例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();
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:15,代码来源:TryListBuilder.java

示例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);
             }
         }
     }
 }
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:67,代码来源:DexBody.java


注:本文中的org.jf.dexlib2.iface.TryBlock.getCodeUnitCount方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。