From 9eb78523624f821a9aaf348f58ef0838a5e7a7dd Mon Sep 17 00:00:00 2001 From: blacktop Date: Tue, 18 Jun 2024 15:25:22 -0600 Subject: [PATCH] fix: dyld.GetSubCacheInfo for the 'primary' sub-cache --- internal/commands/dsc/dsc.go | 14 ++------------ pkg/dyld/file.go | 2 +- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/internal/commands/dsc/dsc.go b/internal/commands/dsc/dsc.go index cc78bf721..ab443a7a2 100644 --- a/internal/commands/dsc/dsc.go +++ b/internal/commands/dsc/dsc.go @@ -614,21 +614,11 @@ func GetStrings(f *dyld.File, pattern string) ([]String, error) { if mapping, err := f.GetMappingForOffsetForUUID(uuid, match); err == nil { s.Mapping = mapping.Name if sc := f.GetSubCacheInfo(uuid); sc != nil { - s.Mapping += ", sub_cache" - if sc.Extention != "" { - s.Mapping += fmt.Sprintf(" (%s)", sc.Extention) - } else { - s.Mapping += " (primary)" - } + s.Mapping += fmt.Sprintf(", sub_cache (%s)", sc.Extention) } } else { if sc := f.GetSubCacheInfo(uuid); sc != nil { - s.Mapping += "sub_cache" - if sc.Extention != "" { - s.Mapping += fmt.Sprintf(" (%s)", sc.Extention) - } else { - s.Mapping += " (primary)" - } + s.Mapping += fmt.Sprintf("sub_cache (%s)", sc.Extention) } } if str, err := f.GetCStringAtOffsetForUUID(uuid, match); err == nil { diff --git a/pkg/dyld/file.go b/pkg/dyld/file.go index ae19333bd..0e0ae9bd0 100644 --- a/pkg/dyld/file.go +++ b/pkg/dyld/file.go @@ -688,7 +688,7 @@ func (f *File) GetSubCacheInfo(uuid mtypes.UUID) *SubcacheEntry { return &SubcacheEntry{ UUID: uuid, CacheVMOffset: 0, - Extention: "", + Extention: "primary", } } if f.symUUID == uuid {