MCPcopy Create free account
hub / github.com/Youlor/unpacker / readCode

Method readCode

dexfixer/src/com/android/dex/Dex.java:475–505  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

473 }
474
475 private Code readCode() {
476 int registersSize = readUnsignedShort();
477 int insSize = readUnsignedShort();
478 int outsSize = readUnsignedShort();
479 int triesSize = readUnsignedShort();
480 int debugInfoOffset = readInt();
481 int instructionsSize = readInt();
482 short[] instructions = readShortArray(instructionsSize);
483 Try[] tries;
484 CatchHandler[] catchHandlers;
485 if (triesSize > 0) {
486 if (instructions.length % 2 == 1) {
487 readShort(); // padding
488 }
489
490 /*
491 * We can't read the tries until we've read the catch handlers.
492 * Unfortunately they're in the opposite order in the dex file
493 * so we need to read them out-of-order.
494 */
495 Section triesSection = open(data.position());
496 skip(triesSize * SizeOf.TRY_ITEM);
497 catchHandlers = readCatchHandlers();
498 tries = triesSection.readTries(triesSize, catchHandlers);
499 } else {
500 tries = new Try[0];
501 catchHandlers = new CatchHandler[0];
502 }
503 return new Code(registersSize, insSize, outsSize, debugInfoOffset, instructions,
504 tries, catchHandlers);
505 }
506
507 private CatchHandler[] readCatchHandlers() {
508 int baseOffset = data.position();

Callers

nothing calls this directly

Calls 8

readUnsignedShortMethod · 0.95
readIntMethod · 0.95
readShortArrayMethod · 0.95
readShortMethod · 0.95
skipMethod · 0.95
readCatchHandlersMethod · 0.95
readTriesMethod · 0.95
openMethod · 0.65

Tested by

no test coverage detected