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


Java ExceptionHandler.getHandlerCodeAddress方法代码示例

本文整理汇总了Java中org.jf.dexlib2.iface.ExceptionHandler.getHandlerCodeAddress方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionHandler.getHandlerCodeAddress方法的具体用法?Java ExceptionHandler.getHandlerCodeAddress怎么用?Java ExceptionHandler.getHandlerCodeAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jf.dexlib2.iface.ExceptionHandler的用法示例。


在下文中一共展示了ExceptionHandler.getHandlerCodeAddress方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addHandler

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public void addHandler(@Nonnull EH handler) {
    for (ExceptionHandler existingHandler: exceptionHandlers) {
        String existingType = existingHandler.getExceptionType();
        String newType = handler.getExceptionType();

        if (existingType == null) {
            if (newType == null) {
                if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                    throw new InvalidTryException(
                            "Multiple overlapping catch all handlers with different handlers");
                }
                return;
            }
        } else if (existingType.equals(newType)) {
            // dalvik doesn't reject cases when there are multiple catches with the same exception
            // but different handlers. In practice, the first handler "wins". Since the later
            // handler will never be used, we don't add it.
            return;
        }
    }

    exceptionHandlers.add(handler);
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:24,代码来源:TryListBuilder.java

示例2: addHandler

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public void addHandler(@Nonnull EH handler) {
    for (ExceptionHandler existingHandler: exceptionHandlers) {
        String existingType = existingHandler.getExceptionType();
        String newType = handler.getExceptionType();

        // Don't add it if we already have a handler of the same type
        if (existingType == null) {
            if (newType == null) {
                if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                    throw new InvalidTryException(
                            "Multiple overlapping catch all handlers with different handlers");
                }
                return;
            }
        } else if (existingType.equals(newType)) {
            if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                throw new InvalidTryException(
                        "Multiple overlapping catches for %s with different handlers", existingType);
            }
            return;
        }
    }

    exceptionHandlers.add(handler);
}
 
开发者ID:Miracle963,项目名称:zjdroid,代码行数:26,代码来源:TryListBuilder.java

示例3: addHandler

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public void addHandler( EH handler) {
    for (ExceptionHandler existingHandler: exceptionHandlers) {
        String existingType = existingHandler.getExceptionType();
        String newType = handler.getExceptionType();

        if (existingType == null) {
            if (newType == null) {
                if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                    throw new InvalidTryException(
                            "Multiple overlapping catch all handlers with different handlers");
                }
                return;
            }
        } else if (existingType.equals(newType)) {
            // dalvik doesn't reject cases when there are multiple catches with the same exception
            // but different handlers. In practice, the first handler "wins". Since the later
            // handler will never be used, we don't add it.
            return;
        }
    }

    exceptionHandlers.add(handler);
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:24,代码来源:TryListBuilder.java

示例4: addHandler

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public void addHandler(@Nonnull EH handler) {
    for (ExceptionHandler existingHandler : exceptionHandlers) {
        String existingType = existingHandler.getExceptionType();
        String newType = handler.getExceptionType();

        // Don't add it if we already have a handler of the same type
        if (existingType == null) {
            if (newType == null) {
                if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                    throw new InvalidTryException(
                            "Multiple overlapping catch all handlers with different handlers");
                }
                return;
            }
        } else if (existingType.equals(newType)) {
            if (existingHandler.getHandlerCodeAddress() != handler.getHandlerCodeAddress()) {
                throw new InvalidTryException(
                        "Multiple overlapping catches for %s with different handlers", existingType);
            }
            return;
        }
    }

    exceptionHandlers.add(handler);
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:26,代码来源:TryListBuilder.java

示例5: of

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public static ImmutableExceptionHandler of(ExceptionHandler exceptionHandler) {
    if (exceptionHandler instanceof ImmutableExceptionHandler) {
        return (ImmutableExceptionHandler)exceptionHandler;
    }
    return new ImmutableExceptionHandler(
            exceptionHandler.getExceptionType(),
            exceptionHandler.getHandlerCodeAddress());
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:9,代码来源:ImmutableExceptionHandler.java

示例6: equals

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ExceptionHandler) {
        ExceptionHandler other = (ExceptionHandler)o;
        return Objects.equal(getExceptionType(), other.getExceptionType()) &&
               (getHandlerCodeAddress() == other.getHandlerCodeAddress());
    }
    return false;
}
 
开发者ID:CvvT,项目名称:andbg,代码行数:10,代码来源:BaseExceptionHandler.java

示例7: equals

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
@Override
public boolean equals( Object o) {
    if (o instanceof ExceptionHandler) {
        ExceptionHandler other = (ExceptionHandler)o;
        return Objects.equal(getExceptionType(), other.getExceptionType()) &&
               (getHandlerCodeAddress() == other.getHandlerCodeAddress());
    }
    return false;
}
 
开发者ID:AndreJCL,项目名称:JCL,代码行数:10,代码来源:BaseExceptionHandler.java

示例8: of

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
public static ImmutableExceptionHandler of(ExceptionHandler exceptionHandler) {
    if (exceptionHandler instanceof ImmutableExceptionHandler) {
        return (ImmutableExceptionHandler) exceptionHandler;
    }
    return new ImmutableExceptionHandler(
            exceptionHandler.getExceptionType(),
            exceptionHandler.getHandlerCodeAddress());
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:9,代码来源:ImmutableExceptionHandler.java

示例9: equals

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
@Override
public boolean equals(@Nullable Object o) {
    if (o instanceof ExceptionHandler) {
        ExceptionHandler other = (ExceptionHandler) o;
        return Objects.equal(getExceptionType(), other.getExceptionType()) &&
                (getHandlerCodeAddress() == other.getHandlerCodeAddress());
    }
    return false;
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:10,代码来源:BaseExceptionHandler.java

示例10: analyzeMoveException

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的package包/类
private void analyzeMoveException(@Nonnull AnalyzedInstruction analyzedInstruction) {
    int instructionAddress = getInstructionAddress(analyzedInstruction);

    RegisterType exceptionType = RegisterType.UNKNOWN_TYPE;

    for (TryBlock<? extends ExceptionHandler> tryBlock : methodImpl.getTryBlocks()) {
        for (ExceptionHandler handler : tryBlock.getExceptionHandlers()) {

            if (handler.getHandlerCodeAddress() == instructionAddress) {
                String type = handler.getExceptionType();
                if (type == null) {
                    exceptionType = RegisterType.getRegisterType(RegisterType.REFERENCE,
                            classPath.getClass("Ljava/lang/Throwable;"));
                } else {
                    exceptionType = RegisterType.getRegisterType(RegisterType.REFERENCE, classPath.getClass(type))
                            .merge(exceptionType);
                }
            }
        }
    }

    if (exceptionType.category == RegisterType.UNKNOWN) {
        throw new AnalysisException("move-exception must be the first instruction in an exception handler block");
    }

    setDestinationRegisterTypeAndPropagateChanges(analyzedInstruction, exceptionType);
}
 
开发者ID:niranjan94,项目名称:show-java,代码行数:28,代码来源:MethodAnalyzer.java

示例11: addTraps

import org.jf.dexlib2.iface.ExceptionHandler; //导入方法依赖的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.ExceptionHandler.getHandlerCodeAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。