+ if ( *infoStart == DYLD_CACHE_ADJ_V2_FORMAT ) {
+ ++infoStart;
+ // Whole :== <count> FromToSection+
+ // FromToSection :== <from-sect-index> <to-sect-index> <count> ToOffset+
+ // ToOffset :== <to-sect-offset-delta> <count> FromOffset+
+ // FromOffset :== <kind> <count> <from-sect-offset-delta>
+ const uint8_t* p = infoStart;
+ uint64_t sectionCount = read_uleb128(p, infoEnd);
+ for (uint64_t i=0; i < sectionCount; ++i) {
+ uint64_t fromSectionIndex = read_uleb128(p, infoEnd);
+ uint64_t toSectionIndex = read_uleb128(p, infoEnd);
+ uint64_t toOffsetCount = read_uleb128(p, infoEnd);
+ const macho_section<P>* fromSection = fSections[fromSectionIndex];
+ const macho_section<P>* toSection = fSections[toSectionIndex];
+ char fromSectionName[20];
+ strncpy(fromSectionName, fromSection->sectname(), 16);
+ fromSectionName[16] = '\0';
+ printf("from sect=%s/%s, to sect=%s/%s, count=%lld:\n", fromSection->segname(), fromSectionName, toSection->segname(), toSection->sectname(), toOffsetCount);
+ uint64_t toSectionOffset = 0;
+ const char* lastFromSymbol = NULL;
+ for (uint64_t j=0; j < toOffsetCount; ++j) {
+ uint64_t toSectionDelta = read_uleb128(p, infoEnd);
+ uint64_t fromOffsetCount = read_uleb128(p, infoEnd);
+ toSectionOffset += toSectionDelta;
+ for (uint64_t k=0; k < fromOffsetCount; ++k) {
+ uint64_t kind = read_uleb128(p, infoEnd);
+ uint64_t fromSectDeltaCount = read_uleb128(p, infoEnd);
+ uint64_t fromSectionOffset = 0;
+ for (uint64_t l=0; l < fromSectDeltaCount; ++l) {
+ uint64_t delta = read_uleb128(p, infoEnd);
+ fromSectionOffset += delta;
+ uint64_t symbolOffset;
+ const char* s = closestSymbolNameForAddress(fromSection->addr()+fromSectionOffset, &symbolOffset, fromSectionIndex);
+ if ( (s != lastFromSymbol) && (s != NULL) )
+ printf(" %s:\n", s);
+ const char* toSymbol = closestSymbolNameForAddress(toSection->addr()+toSectionOffset, &symbolOffset, toSectionIndex);
+ printf(" from addr=0x%0llX %s to addr=0x%0llX", fromSection->addr()+fromSectionOffset, sharedRegionKindName(kind), toSection->addr()+toSectionOffset);
+ if ( toSymbol != NULL ) {
+ if ( symbolOffset == 0 )
+ printf(" (%s)", toSymbol);
+ else
+ printf(" (%s + %lld)", toSymbol, symbolOffset);
+ }
+ printf("\n");
+ lastFromSymbol = s;
+ }
+ }
+ }
+ }
+ }
+ else {
+ for(const uint8_t* p = infoStart; (*p != 0) && (p < infoEnd);) {
+ uint8_t kind = *p++;
+ p = this->printSharedRegionV1InfoForEachULEB128Address(p, infoEnd, kind);
+ }