public Set<String> getSurroundingCaughtExceptions(int pc, int maxTryBlockSize) { HashSet<String> result = new HashSet<>(); if (code == null) { throw new IllegalStateException("Not visiting Code"); } int size = maxTryBlockSize; if (code.getExceptionTable() == null) { return result; } for (CodeException catchBlock : code.getExceptionTable()) { int startPC = catchBlock.getStartPC(); int endPC = catchBlock.getEndPC(); if (pc >= startPC && pc <= endPC) { int thisSize = endPC - startPC; if (size > thisSize) { result.clear(); size = thisSize; result.add("C" + catchBlock.getCatchType()); } else if (size == thisSize) { result.add("C" + catchBlock.getCatchType()); } } } return result; }
public static @CheckForNull CodeException getSurroundingTryBlock(ConstantPool constantPool, Code code, @CheckForNull String vmNameOfExceptionClass, int pc) { int size = Integer.MAX_VALUE; if (code.getExceptionTable() == null) { return null; } CodeException result = null; for (CodeException catchBlock : code.getExceptionTable()) { if (vmNameOfExceptionClass != null) { Constant catchType = constantPool.getConstant(catchBlock.getCatchType()); if (catchType == null && !vmNameOfExceptionClass.isEmpty() || catchType instanceof ConstantClass && !((ConstantClass) catchType).getBytes(constantPool).equals(vmNameOfExceptionClass)) { continue; } } int startPC = catchBlock.getStartPC(); int endPC = catchBlock.getEndPC(); if (pc >= startPC && pc <= endPC) { int thisSize = endPC - startPC; if (size > thisSize) { size = thisSize; result = catchBlock; } } } return result; }
block.normalBlocks.put(codeException.getStartPC(), codeException.getEndPC());
int endPC = catchBlock.getEndPC(); if (pc >= startPC && pc <= endPC) { int thisSize = endPC - startPC;
int handled = aExp.getHandlerPC(); int start = aExp.getStartPC(); int end = aExp.getEndPC(); int cause = aExp.getCatchType(); boolean exitInTryBlock = false;
for (CodeException e : code.getExceptionTable()) { ConstantClass cl = (ConstantClass) cp.getConstant(e.getCatchType()); int endPC = e.getEndPC(); int startPC = e.getStartPC(); int handlerPC = e.getHandlerPC();
if (tryBlock != null && tryBlock.getEndPC() == getPC()) { pendingBug.lowerPriority();
ExceptionCaught caughtException = new ExceptionCaught(name, obj.getStartPC(), obj.getEndPC(), obj.getHandlerPC()); catchList.add(caughtException);
public int getEndPC() { return codeException.getEndPC(); }
/** * collects all the valid exception objects (ones where start and finish are before the target * * @param exs * the exceptions from the class file * @return the filtered exceptions */ public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce); } } return filteredEx.toArray(new CodeException[filteredEx.size()]); }
/** * collects all the valid exception objects (ones where start and finish are before the target * * @param exs * the exceptions from the class file * @return the filtered exceptions */ public CodeException[] collectExceptions(CodeException... exs) { List<CodeException> filteredEx = new ArrayList<>(); for (CodeException ce : exs) { if ((ce.getCatchType() != 0) && (ce.getStartPC() < ce.getEndPC()) && (ce.getEndPC() <= ce.getHandlerPC())) { filteredEx.add(ce); } } return filteredEx.toArray(new CodeException[0]); }
TryBlock(CodeException ce) { startPC = ce.getStartPC(); endPC = ce.getEndPC(); handlerPC = ce.getHandlerPC(); endHandlerPC = -1; catchTypes = new BitSet(); catchTypes.set(ce.getCatchType()); state = State.BEFORE; }
TryBlock(CodeException ce) { startPC = ce.getStartPC(); endPC = ce.getEndPC(); handlerPC = ce.getHandlerPC(); endHandlerPC = -1; catchTypes = new BitSet(); catchTypes.set(ce.getCatchType()); state = State.BEFORE; }
public int[] getExceptionScope(){ try { CodeException[] exceptionTable = this.code.getExceptionTable(); int[] exception_scop = new int[exceptionTable.length * 2]; for (int i = 0; i < exceptionTable.length; i++) { exception_scop[i * 2] = exceptionTable[i].getStartPC(); exception_scop[i * 2 + 1] = exceptionTable[i].getEndPC(); } return exception_scop; }catch (Exception e){ // e.printStackTrace(); } return new int[0]; }
@Override public void visitCode(Code obj) { if (prescreen()) { stack.resetForMethodEntry(this); allocationRegs.clear(); transitionPoints.clear(); CodeException[] ce = obj.getExceptionTable(); if (ce != null) { for (CodeException element : ce) { transitionPoints.set(element.getEndPC()); } } super.visitCode(obj); } }
@Override public void visitCode(Code obj) { if (prescreen()) { stack.resetForMethodEntry(this); allocationRegs.clear(); transitionPoints.clear(); CodeException[] ce = obj.getExceptionTable(); if (ce != null) { for (CodeException element : ce) { transitionPoints.set(element.getEndPC()); } } super.visitCode(obj); } }
/** * Initialize from another object. */ public CodeException(CodeException c) { this(c.getStartPC(), c.getEndPC(), c.getHandlerPC(), c.getCatchType()); }
/** * Initialize from another object. */ public CodeException(final CodeException c) { this(c.getStartPC(), c.getEndPC(), c.getHandlerPC(), c.getCatchType()); }
public CodeEntry(Code c) { super(c.getNameIndex(), c.getLength()); maxStack = c.getMaxStack(); maxLocals = c.getMaxLocals(); code = c.getCode(); for (CodeException i : c.getExceptionTable()) { exceptionPoolEntries.add(new ExceptionPoolEntry(i.getStartPC(), i.getEndPC(), i.getHandlerPC(), i.getCatchType())); } codeEntryAttributePool = new AttributePool(c.getAttributes(), getName()); }