fix(apple): preserve modern cache subtype metadata

This commit is contained in:
morluto
2026-10-08 23:26:33 +08:00
parent 8289ede5db
commit 22e6110acb
6 changed files with 95 additions and 3 deletions
@@ -571,6 +571,7 @@ export class DyldSharedCache {
const cacheType = has(parsed, FIELD.cacheType, 8)
? Number(header.readBigUInt64LE(FIELD.cacheType))
: null;
const cacheSubType = cacheType === 2 ? u32(FIELD.cacheSubType) : null;
const symbols = has(parsed, FIELD.symbolFileUuid, 16)
? header.subarray(FIELD.symbolFileUuid, FIELD.symbolFileUuid + 16)
: undefined;
@@ -606,6 +607,18 @@ export class DyldSharedCache {
cacheType,
has(parsed, FIELD.cacheSubType, 4),
),
cache_subtype:
cacheSubType !== null
? {
id: cacheSubType,
name:
cacheSubType === 0
? "development"
: cacheSubType === 1
? "production"
: null,
}
: null,
shared_region:
u64(FIELD.sharedRegionStart) === null
? null
+10
View File
@@ -45,6 +45,16 @@ const headerSchema = z.object({
alt_platform: applePlatformSchema.nullable(),
alt_os_version: z.string().nullable(),
cache_type: z.enum(["development", "production", "multi-cache"]).nullable(),
cache_subtype: z
.object({
id: z.number().int().nonnegative(),
name: z.enum(["development", "production"]).nullable(),
})
.nullable()
.default(null)
.describe(
"Multi-cache subtype from the producer header: 0 is development, 1 is production; unknown values retain their ID with a null name. Null when absent or not applicable.",
),
shared_region: z.object({ start: hexSchema, size: hexSchema }).nullable(),
max_slide: hexSchema.nullable(),
mappings: z.array(mappingSchema),