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; }
public boolean atCatchBlock() { for (CodeException e : getCode().getExceptionTable()) { if (e.getHandlerPC() == getPC()) { return true; } } return false; }
@Override public void visit(Method method) { String cName = getDottedClassName(); for(SubDetector subDetector : subDetectors) { subDetector.initMethod(method); } // System.out.println(getFullyQualifiedMethodName()); isPublicStaticVoidMain = method.isPublic() && method.isStatic() && "main".equals(getMethodName()) || cName.toLowerCase().indexOf("benchmark") >= 0; prevOpcodeWasReadLine = false; Code code = method.getCode(); if (code != null) { this.exceptionTable = code.getExceptionTable(); } if (this.exceptionTable == null) { this.exceptionTable = new CodeException[0]; } primitiveObjCtorSeen = null; ctorSeen = false; randomNextIntState = 0; checkForBitIorofSignedByte = false; sinceBufferedInputStreamReady = 100000; sawCheckForNonNegativeSignedByte = -1000; sawLoadOfMinValue = false; previousMethodCall = null; }
@Override public void visitCode(Code obj) { code = obj; super.visitCode(obj); CodeException[] exceptions = obj.getExceptionTable(); for (CodeException exception : exceptions) { exception.accept(this); } Attribute[] attributes = obj.getAttributes(); for (Attribute attribute : attributes) { attribute.accept(this); } visitAfter(obj); code = null; }
return lineMentionedMultipleTimes; CodeException[] exceptionTable = code.getExceptionTable(); if (exceptionTable == null || exceptionTable.length == 0) { return lineMentionedMultipleTimes;
for(CodeException codeException : method.getCode().getExceptionTable()) { if(codeException.getCatchType() == 0) { TryBlock block = finallyTargets.get(codeException.getHandlerPC());
int tightStartPC = 0; int tightEndPC = Integer.MAX_VALUE; if (code.getExceptionTable() == null) { return size; for (CodeException catchBlock : code.getExceptionTable()) { if (vmNameOfExceptionClass != null) { Constant catchType = constantPool.getConstant(catchBlock.getCatchType());
} else { int pc = redundantBranch.location.getHandle().getPosition(); for (CodeException e : method.getCode().getExceptionTable()) { if (e.getCatchType() == 0 && e.getStartPC() != e.getHandlerPC() && e.getEndPC() <= pc && pc <= e.getEndPC() + 5) {
private boolean uniqueLocations(Collection<Location> derefLocationSet) { boolean uniqueDereferenceLocations = false; CodeException[] exceptionTable = method.getCode().getExceptionTable(); if (exceptionTable == null) { return true; } checkForCatchAll: { for (CodeException e : exceptionTable) { if (e.getCatchType() == 0) { break checkForCatchAll; } } return true; } LineNumberTable table = method.getLineNumberTable(); if (table == null) { uniqueDereferenceLocations = true; } else { BitSet linesMentionedMultipleTimes = classContext.linesMentionedMultipleTimes(method); for (Location loc : derefLocationSet) { int lineNumber = table.getSourceLine(loc.getHandle().getPosition()); if (lineNumber > 0 && !linesMentionedMultipleTimes.get(lineNumber)) { uniqueDereferenceLocations = true; } } } return uniqueDereferenceLocations; }
Code code = m.getCode(); if (code != null) { CodeException[] exceptionTable = code.getExceptionTable(); if (exceptionTable != null) { for (CodeException ex : exceptionTable) {
for (CodeException e : dbc.getCode().getExceptionTable()) { if (e.getHandlerPC() == dbc.getPC()) { Item newItem = new Item(getExceptionSig(dbc, e));
public void visit(Code obj) { CodeException[] exp = obj.getExceptionTable(); LineNumberTable lineNumbers = obj.getLineNumberTable(); if (exp == null) {
for(CodeException ex : getCode().getExceptionTable()) { if(ex.getCatchType() == 0) { finallyTargets.add(ex.getHandlerPC());
ConstantPool cp = jclass.getConstantPool(); byte codeBytes[] = code.getCode(); for (CodeException e : code.getExceptionTable()) { ConstantClass cl = (ConstantClass) cp.getConstant(e.getCatchType()); int endPC = e.getEndPC();
for (CodeException e : getCode().getExceptionTable()) { if (e.getHandlerPC() <= getPC() && e.getHandlerPC() + 30 >= getPC()) { debuggingContext = true;
public void visitCode(Code code) { stack.push(code); code.accept(visitor); CodeException[] table = code.getExceptionTable(); for(int i=0; i < table.length; i++) table[i].accept(this); Attribute[] attributes = code.getAttributes(); for(int i=0; i < attributes.length; i++) attributes[i].accept(this); stack.pop(); }
public boolean atCatchBlock() { for (CodeException e : getCode().getExceptionTable()) { if (e.getHandlerPC() == getPC()) { return true; } } return false; }
/** * Initialize from another object. Note that both objects use the same * references (shallow copy). Use copy() for a physical copy. */ public Code(Code c) { this(c.getNameIndex(), c.getLength(), c.getMaxStack(), c.getMaxLocals(), c.getCode(), c.getExceptionTable(), c.getAttributes(), c.getConstantPool()); }
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()); }