/** * Does a human-friendly dump of this instance. * * @param out {@code non-null;} where to dump * @param prefix {@code non-null;} prefix to attach to each line of output */ public void debugPrint(PrintWriter out, String prefix) { annotateEntries(prefix, out, null); }
/** * Gets the size of the tries list, in entries. * * @return {@code >= 0;} the tries list size */ public int triesSize() { finishProcessingIfNecessary(); return table.size(); }
/** * Gets the write size of this instance, in bytes. * * @return {@code >= 0;} the write size */ public int writeSize() { return (triesSize() * TRY_ITEM_WRITE_SIZE) + + encodedHandlers.length; }
/** * Writes this instance to the given stream. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ public void writeTo(DexFile file, AnnotatedOutput out) { finishProcessingIfNecessary(); if (out.annotates()) { annotateEntries(" ", null, out); } int tableSize = table.size(); for (int i = 0; i < tableSize; i++) { CatchTable.Entry one = table.get(i); int start = one.getStart(); int end = one.getEnd(); int insnCount = end - start; if (insnCount >= 65536) { throw new UnsupportedOperationException( "bogus exception range: " + Hex.u4(start) + ".." + Hex.u4(end)); } out.writeInt(start); out.writeShort(insnCount); out.writeShort(handlerOffsets.get(one.getHandlers())); } out.write(encodedHandlers); }
finishProcessingIfNecessary(); annotateAndConsumeHandlers(lastList, lastOffset, offset - lastOffset, subPrefix, printTo, annotateTo); annotateAndConsumeHandlers(lastList, lastOffset, encodedHandlers.length - lastOffset, subPrefix, printTo, annotateTo);
/** {@inheritDoc} */ public void addContents(DexFile file) { MixedItemSection byteData = file.getByteData(); TypeIdsSection typeIds = file.getTypeIds(); if (code.hasPositions() || code.hasLocals()) { debugInfo = new DebugInfoItem(code, isStatic, ref); byteData.add(debugInfo); } if (code.hasAnyCatches()) { for (Type type : code.getCatchTypes()) { typeIds.intern(type); } catches = new CatchStructs(code); } for (Constant c : code.getInsnConstants()) { file.internIfAppropriate(c); } }
/** * Does a human-friendly dump of this instance. * * @param out {@code non-null;} where to dump * @param prefix {@code non-null;} per-line prefix to use * @param verbose whether to be verbose with the output */ public void debugPrint(PrintWriter out, String prefix, boolean verbose) { out.println(ref.toHuman() + ":"); DalvInsnList insns = code.getInsns(); out.println("regs: " + Hex.u2(getRegistersSize()) + "; ins: " + Hex.u2(getInsSize()) + "; outs: " + Hex.u2(getOutsSize())); insns.debugPrint(out, prefix, verbose); String prefix2 = prefix + " "; if (catches != null) { out.print(prefix); out.println("catches"); catches.debugPrint(out, prefix2); } if (debugInfo != null) { out.print(prefix); out.println("debug info"); debugInfo.debugPrint(out, prefix2); } }
/** * Writes this instance to the given stream. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ public void writeTo(DexFile file, AnnotatedOutput out) { finishProcessingIfNecessary(); if (out.annotates()) { annotateEntries(" ", null, out); } int tableSize = table.size(); for (int i = 0; i < tableSize; i++) { CatchTable.Entry one = table.get(i); int start = one.getStart(); int end = one.getEnd(); int insnCount = end - start; if (insnCount >= 65536) { throw new UnsupportedOperationException( "bogus exception range: " + Hex.u4(start) + ".." + Hex.u4(end)); } out.writeInt(start); out.writeShort(insnCount); out.writeShort(handlerOffsets.get(one.getHandlers())); } out.write(encodedHandlers); }
finishProcessingIfNecessary(); annotateAndConsumeHandlers(lastList, lastOffset, offset - lastOffset, subPrefix, printTo, annotateTo); annotateAndConsumeHandlers(lastList, lastOffset, encodedHandlers.length - lastOffset, subPrefix, printTo, annotateTo);
/** {@inheritDoc} */ public void addContents(DexFile file) { MixedItemSection byteData = file.getByteData(); TypeIdsSection typeIds = file.getTypeIds(); if (code.hasPositions() || code.hasLocals()) { debugInfo = new DebugInfoItem(code, isStatic, ref); byteData.add(debugInfo); } if (code.hasAnyCatches()) { for (Type type : code.getCatchTypes()) { typeIds.intern(type); } catches = new CatchStructs(code); } for (Constant c : code.getInsnConstants()) { file.internIfAppropriate(c); } }
/** * Does a human-friendly dump of this instance. * * @param out {@code non-null;} where to dump * @param prefix {@code non-null;} per-line prefix to use * @param verbose whether to be verbose with the output */ public void debugPrint(PrintWriter out, String prefix, boolean verbose) { out.println(ref.toHuman() + ":"); DalvInsnList insns = code.getInsns(); out.println("regs: " + Hex.u2(getRegistersSize()) + "; ins: " + Hex.u2(getInsSize()) + "; outs: " + Hex.u2(getOutsSize())); insns.debugPrint(out, prefix, verbose); String prefix2 = prefix + " "; if (catches != null) { out.print(prefix); out.println("catches"); catches.debugPrint(out, prefix2); } if (debugInfo != null) { out.print(prefix); out.println("debug info"); debugInfo.debugPrint(out, prefix2); } }
/** * Writes this instance to the given stream. * * @param file {@code non-null;} file this instance is part of * @param out {@code non-null;} where to write to */ public void writeTo(DexFile file, AnnotatedOutput out) { finishProcessingIfNecessary(); if (out.annotates()) { annotateEntries(" ", null, out); } int tableSize = table.size(); for (int i = 0; i < tableSize; i++) { CatchTable.Entry one = table.get(i); int start = one.getStart(); int end = one.getEnd(); int insnCount = end - start; if (insnCount >= 65536) { throw new UnsupportedOperationException( "bogus exception range: " + Hex.u4(start) + ".." + Hex.u4(end)); } out.writeInt(start); out.writeShort(insnCount); out.writeShort(handlerOffsets.get(one.getHandlers())); } out.write(encodedHandlers); }
finishProcessingIfNecessary(); annotateAndConsumeHandlers(lastList, lastOffset, offset - lastOffset, subPrefix, printTo, annotateTo); annotateAndConsumeHandlers(lastList, lastOffset, encodedHandlers.length - lastOffset, subPrefix, printTo, annotateTo);
/** * Gets the size of the tries list, in entries. * * @return {@code >= 0;} the tries list size */ public int triesSize() { finishProcessingIfNecessary(); return table.size(); }