@Nonnull public Iterator<String> getParameterNames(@Nullable DexReader dexReader) { return getDebugInfo().getParameterNames(dexReader); }
@Nonnull private DebugInfo getDebugInfo() { int debugOffset = dexFile.readInt(codeOffset + CodeItem.DEBUG_INFO_OFFSET); if (debugOffset == -1 || debugOffset == 0) { return DebugInfo.newOrEmpty(dexFile, 0, this); } if (debugOffset < 0) { System.err.println(String.format("%s: Invalid debug offset", method)); return DebugInfo.newOrEmpty(dexFile, 0, this); } if (debugOffset >= dexFile.buf.length) { System.err.println(String.format("%s: Invalid debug offset", method)); return DebugInfo.newOrEmpty(dexFile, 0, this); } return DebugInfo.newOrEmpty(dexFile, debugOffset, this); }
/** * Calculate and return the private size of a method implementation. * * Calculated as: debug info size + instructions size + try-catch size * * @return size in bytes */ public int getSize() { int debugSize = getDebugInfo().getSize(); //set last offset just before bytecode instructions (after insns_size) int lastOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET; //set code_item ending offset to the end of instructions list (insns_size * ushort) lastOffset += dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET) * 2; //read any exception handlers and move code_item offset to the end for (DexBackedTryBlock tryBlock: getTryBlocks()) { Iterator<? extends DexBackedExceptionHandler> tryHandlerIter = tryBlock.getExceptionHandlers().iterator(); while (tryHandlerIter.hasNext()) { tryHandlerIter.next(); } lastOffset = ((VariableSizeListIterator)tryHandlerIter).getReaderOffset(); } //method impl size = debug block size + code_item size return debugSize + (lastOffset - codeOffset); } }
@Nonnull public Iterator<String> getParameterNames(@Nullable DexReader dexReader) { return getDebugInfo().getParameterNames(dexReader); } }
@Nonnull private DebugInfo getDebugInfo() { int debugOffset = dexFile.readInt(codeOffset + CodeItem.DEBUG_INFO_OFFSET); if (debugOffset == -1 || debugOffset == 0) { return DebugInfo.newOrEmpty(dexFile, 0, this); } if (debugOffset < 0) { System.err.println(String.format("%s: Invalid debug offset", method)); return DebugInfo.newOrEmpty(dexFile, 0, this); } if (debugOffset >= dexFile.buf.length) { System.err.println(String.format("%s: Invalid debug offset", method)); return DebugInfo.newOrEmpty(dexFile, 0, this); } return DebugInfo.newOrEmpty(dexFile, debugOffset, this); }
/** * Calculate and return the private size of a method implementation. * * Calculated as: debug info size + instructions size + try-catch size * * @return size in bytes */ public int getSize() { int debugSize = getDebugInfo().getSize(); //set last offset just before bytecode instructions (after insns_size) int lastOffset = codeOffset + CodeItem.INSTRUCTION_START_OFFSET; //set code_item ending offset to the end of instructions list (insns_size * ushort) lastOffset += dexFile.readSmallUint(codeOffset + CodeItem.INSTRUCTION_COUNT_OFFSET) * 2; //read any exception handlers and move code_item offset to the end for (DexBackedTryBlock tryBlock: getTryBlocks()) { Iterator<? extends DexBackedExceptionHandler> tryHandlerIter = tryBlock.getExceptionHandlers().iterator(); while (tryHandlerIter.hasNext()) { tryHandlerIter.next(); } lastOffset = ((VariableSizeListIterator)tryHandlerIter).getReaderOffset(); } //method impl size = debug block size + code_item size return debugSize + (lastOffset - codeOffset); } }
@Nonnull public Iterator<String> getParameterNames(@Nullable DexReader dexReader) { return getDebugInfo().getParameterNames(dexReader); }
@Nonnull private DebugInfo getDebugInfo() { return DebugInfo.newOrEmpty(dexFile, dexFile.readSmallUint(codeOffset + CodeItem.DEBUG_INFO_OFFSET), this); }