Class DyldCacheHeader
java.lang.Object
ghidra.app.util.bin.format.macho.dyld.DyldCacheHeader
- All Implemented Interfaces:
StructConverter
Represents a dyld_cache_header structure.
- See Also:
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the old accelerate info address or new address of mach header in dyld cache, ornull
if it is not defined.long
Returns the old accelerate info size or new address of entry point in dyld cache, ornull
if it is not defined.int
Returns the alt OS version.int
Returns the alt platform.Gets architecture information.long
Returns the base address of the DYLD cache.Gets theList
of branch pool address.int
Returns the branch pools count.int
Returns the branch pools offset.boolean
Returns the built from chained fixups value.long
Returns the cache atlas offset.long
Returns the cache atlas size.Gets theList
ofDyldCacheMappingAndSlideInfo
s.Returns the cache subtype, ornull
if it is not defined.long
Returns the cache type.long
Returns the code signature offset.long
Returns the code signature size.long
Returns the dyld base address.int
Returns the dyld info.boolean
Returns the dylibs expected on disk value.long
Returns the dylibs image array address.long
Returns the dylibs image array size.long
Returns the dylibs PrebuildLoaderSet set address.long
Returns the dylibs PrebuildLoaderSet state array address (unused), ornull
if it is not defined.long
Returns the dylibs trie address.long
Returns the dylibs trie size.long
Returns the dynamic data max size.long
Returns the dynamic data offset.int
Returns the format version.int
Returns the images count.int
Returns the old images count.int
Returns the images offset.int
Returns the old images offset.long
Returns the images text count.long
Returns the images text offset.boolean
Returns the locally built cache value.Gets theDyldCacheLocalSymbolsInfo
.long
Returns the local symbols offset.long
Returns the local symbols size.byte[]
getMagic()
Returns the magic bytes, which contain version information.int
Returns the mapping count.Gets theList
ofDyldCacheMappingInfo
s.int
Returns the mapping offset.int
Returns the mapping with slide count.int
Returns the mapping with slide offset.long
Returns the max slide.long
Returns the ObjC opts offset.long
Returns the ObjC opts size.int
Returns the OS version.long
Returns the other image array address.long
Returns the other image array size.long
Returns the other image group address (unused).long
Returns the other image group size (unused).long
Returns the other trie address.long
Returns the other trie size.long
Returns the patch info address.long
Returns the patch info size.int
Returns the platform.long
Returns the program launch closures address.long
Returns the program launch closures size.long
Returns the program launch closures trie address.long
Returns the program launch closures trie size.long
Returns the programs PrebuildLoaderSet set pool address, ornull
if it is not defined.long
Returns the programs PrebuildLoaderSet set pool size.long
Returns the program trie address.int
Returns the program trie size.Returns the reader associated with the header.long
Returns the rosetta read-only address.long
Returns the rosetta read-only size.long
Returns the rosetta read-write address.long
Returns the rosetta read-write size.long
Returns the shared region size.long
Returns the shared region start.boolean
Returns the simulator value.long
Returns the slide info offset.Gets theList
ofDyldCacheSlideInfoCommon
s.long
Returns the slide info size.Returns the subcache array count, ornull
if it is not defined.int
Returns the subcache array offset.Gets theList
ofDyldSubcacheEntry
s.long
Returns the swift opts offset.long
Returns the swift opts size.byte[]
Returns the symbol file UUID, ornull
if it is not defined.int
Returns the tpro mappings count.int
Returns the tpro mappings offset.byte[]
getUUID()
Returns the UUID, ornull
if it is not defined.boolean
Checks to see whether or not the old accelerate info fields are being usedboolean
Checks to see if any slide info existsboolean
Checks to see whether or not this is a subcachevoid
markup
(Program program, boolean markupLocalSymbols, AddressSpace space, TaskMonitor monitor, MessageLog log) Marks up thisDyldCacheHeader
with data structures and comments.void
parseFromFile
(boolean parseLocalSymbols, MessageLog log, TaskMonitor monitor) Parses the structures referenced by thisDyldCacheHeader
from a file.void
parseFromMemory
(Program program, AddressSpace space, MessageLog log, TaskMonitor monitor) Parses the structures referenced by thisDyldCacheHeader
from memory.void
parseLocalSymbolsInfo
(boolean shouldParse, MessageLog log, TaskMonitor monitor) void
setFileBlock
(MemoryBlock block) Sets theMemoryBlock
associated with this header's FILE block.Returns a structure datatype representing the contents of the implementor of this interface.long
Get the original unslid load address.
-
Constructor Details
-
DyldCacheHeader
Create a newDyldCacheHeader
.- Parameters:
reader
- ABinaryReader
positioned at the start of a DYLD cache header- Throws:
IOException
- if there was an IO-related problem creating the DYLD cache header
-
-
Method Details
-
parseFromFile
public void parseFromFile(boolean parseLocalSymbols, MessageLog log, TaskMonitor monitor) throws CancelledException Parses the structures referenced by thisDyldCacheHeader
from a file.- Parameters:
parseLocalSymbols
- True if local symbols should be parsed; otherwise, falselog
- The logmonitor
- A cancellable task monitor- Throws:
CancelledException
- if the user cancelled the operation
-
parseFromMemory
public void parseFromMemory(Program program, AddressSpace space, MessageLog log, TaskMonitor monitor) throws CancelledException Parses the structures referenced by thisDyldCacheHeader
from memory.- Parameters:
program
- TheProgram
whose memory to parsespace
- TheProgram
'sAddressSpace
log
- The logmonitor
- A cancellable task monitor- Throws:
CancelledException
- if the user cancelled the operation
-
markup
public void markup(Program program, boolean markupLocalSymbols, AddressSpace space, TaskMonitor monitor, MessageLog log) throws CancelledException Marks up thisDyldCacheHeader
with data structures and comments.- Parameters:
program
- TheProgram
to mark upmarkupLocalSymbols
- True if the local symbols should be marked up; otherwise, falsespace
- TheProgram
'sAddressSpace
monitor
- A cancellable task monitorlog
- The log- Throws:
CancelledException
- if the user cancelled the operation
-
getMagic
public byte[] getMagic()Returns the magic bytes, which contain version information.- Returns:
- the magic bytes, which contain version information
-
getMappingOffset
public int getMappingOffset()Returns the mapping offset.- Returns:
- the mapping offset
-
getMappingCount
public int getMappingCount()Returns the mapping count.- Returns:
- the mapping count
-
getImagesOffsetOld
public int getImagesOffsetOld()Returns the old images offset.- Returns:
- the old images offset
-
getImagesCountOld
public int getImagesCountOld()Returns the old images count.- Returns:
- the old images count
-
getDyldBaseAddress
public long getDyldBaseAddress()Returns the dyld base address.- Returns:
- the dyld base address
-
getCodeSignatureOffset
public long getCodeSignatureOffset()Returns the code signature offset.- Returns:
- the code signature offset
-
getCodeSignatureSize
public long getCodeSignatureSize()Returns the code signature size.- Returns:
- the code signature size
-
getSlideInfoOffset
public long getSlideInfoOffset()Returns the slide info offset.- Returns:
- the slide info offset
-
getSlideInfoSize
public long getSlideInfoSize()Returns the slide info size.- Returns:
- the slide info size
-
getLocalSymbolsOffset
public long getLocalSymbolsOffset()Returns the local symbols offset.- Returns:
- the local symbols offset
-
getLocalSymbolsSize
public long getLocalSymbolsSize()Returns the local symbols size.- Returns:
- the local symbols size
-
getUUID
public byte[] getUUID()Returns the UUID, ornull
if it is not defined.- Returns:
- the UUID, or
null
if it is not defined
-
getCacheType
public long getCacheType()Returns the cache type.- Returns:
- the cache type
-
getBranchPoolsOffset
public int getBranchPoolsOffset()Returns the branch pools offset.- Returns:
- the branch pools offset
-
getBranchPoolsCount
public int getBranchPoolsCount()Returns the branch pools count.- Returns:
- the branch pools count
-
getAccelerateInfoAddrOrDyldInCacheMH
public long getAccelerateInfoAddrOrDyldInCacheMH()Returns the old accelerate info address or new address of mach header in dyld cache, ornull
if it is not defined.- Returns:
- the old accelerate info address or new address of mach header in dyld cache, or
null
if it is not defined
-
getAccelerateInfoSizeOrDyldInCacheEntry
public long getAccelerateInfoSizeOrDyldInCacheEntry()Returns the old accelerate info size or new address of entry point in dyld cache, ornull
if it is not defined.- Returns:
- the old accelerate info size or new address of entry point in dyld cache, or
null
if it is not defined
-
getImagesTextOffset
public long getImagesTextOffset()Returns the images text offset.- Returns:
- the images text offset
-
getImagesTextCount
public long getImagesTextCount()Returns the images text count.- Returns:
- the images text count
-
getPatchInfoAddr
public long getPatchInfoAddr()Returns the patch info address.- Returns:
- the patch info address
-
getPatchInfoSize
public long getPatchInfoSize()Returns the patch info size.- Returns:
- the patch info size
-
getOtherImageGroupAddrUnused
public long getOtherImageGroupAddrUnused()Returns the other image group address (unused).- Returns:
- the other image group address (unused)
-
getOtherImageGroupSizeUnused
public long getOtherImageGroupSizeUnused()Returns the other image group size (unused).- Returns:
- the other image group size (unused)
-
getProgClosuresAddr
public long getProgClosuresAddr()Returns the program launch closures address.- Returns:
- the program launch closures address
-
getProgClosuresSize
public long getProgClosuresSize()Returns the program launch closures size.- Returns:
- the program launch closures size
-
getProgClosuresTrieAddr
public long getProgClosuresTrieAddr()Returns the program launch closures trie address.- Returns:
- the program launch closures trie address
-
getProgClosuresTrieSize
public long getProgClosuresTrieSize()Returns the program launch closures trie size.- Returns:
- the program launch closures trie size
-
getPlatform
public int getPlatform()Returns the platform.- Returns:
- the platform
-
getDyldInfo
public int getDyldInfo()Returns the dyld info.- Returns:
- the dyld info
-
getFormatVersion
public int getFormatVersion()Returns the format version.- Returns:
- the format version
-
getDylibsExpectedOnDisk
public boolean getDylibsExpectedOnDisk()Returns the dylibs expected on disk value.- Returns:
- the dylibs expected on disk value
-
getSimulator
public boolean getSimulator()Returns the simulator value.- Returns:
- the simulator value
-
getLocallyBuildCache
public boolean getLocallyBuildCache()Returns the locally built cache value.- Returns:
- the locally built cache value
-
getBuiltFromChainedFixups
public boolean getBuiltFromChainedFixups()Returns the built from chained fixups value.- Returns:
- the built from chained fixups value
-
getMaxSlide
public long getMaxSlide()Returns the max slide.- Returns:
- the max slide
-
getDylibsImageArrayAddr
public long getDylibsImageArrayAddr()Returns the dylibs image array address.- Returns:
- the dylibs image array address
-
getDylibsImageArraySize
public long getDylibsImageArraySize()Returns the dylibs image array size.- Returns:
- the dylibs image array size
-
getDylibsTriAddr
public long getDylibsTriAddr()Returns the dylibs trie address.- Returns:
- the dylibs trie address
-
getDylibsTrieSize
public long getDylibsTrieSize()Returns the dylibs trie size.- Returns:
- the dylibs trie size
-
getOtherImageArrayAddr
public long getOtherImageArrayAddr()Returns the other image array address.- Returns:
- the other image array address
-
getOtherImageArraySize
public long getOtherImageArraySize()Returns the other image array size.- Returns:
- the other image array size
-
getOtherTriAddr
public long getOtherTriAddr()Returns the other trie address.- Returns:
- the other trie address
-
getOtherTrieSize
public long getOtherTrieSize()Returns the other trie size.- Returns:
- the other trie size
-
getMappingWithSlideOffset
public int getMappingWithSlideOffset()Returns the mapping with slide offset.- Returns:
- the mapping with slide offset
-
getMappingWithSlideCount
public int getMappingWithSlideCount()Returns the mapping with slide count.- Returns:
- the mapping with slide count
-
getDylibsPBLStateArrayAddrUnused
public long getDylibsPBLStateArrayAddrUnused()Returns the dylibs PrebuildLoaderSet state array address (unused), ornull
if it is not defined.- Returns:
- the dylibs PrebuildLoaderSet state array address (unused), or
null
if it is not defined
-
getDylibsPBLSetAddr
public long getDylibsPBLSetAddr()Returns the dylibs PrebuildLoaderSet set address.- Returns:
- the dylibs PrebuildLoaderSet set address
-
getProgramsPBLSetPoolAddr
public long getProgramsPBLSetPoolAddr()Returns the programs PrebuildLoaderSet set pool address, ornull
if it is not defined.- Returns:
- the programs PrebuildLoaderSet set pool address, or
null
if it is not defined
-
getProgramsPBLSetPoolSize
public long getProgramsPBLSetPoolSize()Returns the programs PrebuildLoaderSet set pool size.- Returns:
- the programs PrebuildLoaderSet set pool size
-
getProgramTrieAddr
public long getProgramTrieAddr()Returns the program trie address.- Returns:
- the program trie address
-
getProgramTrieSize
public int getProgramTrieSize()Returns the program trie size.- Returns:
- the program trie size
-
getOsVersion
public int getOsVersion()Returns the OS version.- Returns:
- the OS version
-
getAltPlatform
public int getAltPlatform()Returns the alt platform.- Returns:
- the alt platform
-
getAltOsVersion
public int getAltOsVersion()Returns the alt OS version.- Returns:
- the alt OS version
-
getSwiftOptsOffset
public long getSwiftOptsOffset()Returns the swift opts offset.- Returns:
- the swift opts offset
-
getSwiftOptsSize
public long getSwiftOptsSize()Returns the swift opts size.- Returns:
- the swift opts size
-
getSubCacheArrayOffset
public int getSubCacheArrayOffset()Returns the subcache array offset.- Returns:
- the subcache array offset
-
getSubCacheArrayCount
Returns the subcache array count, ornull
if it is not defined.- Returns:
- the subcache array count, or
null
if it is not defined
-
getSymbolFileUUID
public byte[] getSymbolFileUUID()Returns the symbol file UUID, ornull
if it is not defined.- Returns:
- the symbol file UUID, or
null
if it is not defined
-
getRosettaReadOnlyAddr
public long getRosettaReadOnlyAddr()Returns the rosetta read-only address.- Returns:
- the rosetta read-only address
-
getRosettaReadOnlySize
public long getRosettaReadOnlySize()Returns the rosetta read-only size.- Returns:
- the rosetta read-only size
-
getRosettaReadWriteAddr
public long getRosettaReadWriteAddr()Returns the rosetta read-write address.- Returns:
- the rosetta read-write address
-
getRosettaReadWriteSize
public long getRosettaReadWriteSize()Returns the rosetta read-write size.- Returns:
- the rosetta read-write size
-
getImagesOffset
public int getImagesOffset()Returns the images offset.- Returns:
- the images offset
-
getImagesCount
public int getImagesCount()Returns the images count.- Returns:
- the images count
-
getCacheSubType
Returns the cache subtype, ornull
if it is not defined.- Returns:
- the cache subtype, or
null
if it is not defined
-
getObjcOptsOffset
public long getObjcOptsOffset()Returns the ObjC opts offset.- Returns:
- the ObjC opts offset
-
getObjcOptsSize
public long getObjcOptsSize()Returns the ObjC opts size.- Returns:
- the ObjC opts size
-
getCacheAtlasOffset
public long getCacheAtlasOffset()Returns the cache atlas offset.- Returns:
- the cache atlas offset
-
getCacheAtlasSize
public long getCacheAtlasSize()Returns the cache atlas size.- Returns:
- the cache atlas size
-
getDynamicDataOffset
public long getDynamicDataOffset()Returns the dynamic data offset.- Returns:
- the dynamic data offset
-
getDynamicDataMaxSize
public long getDynamicDataMaxSize()Returns the dynamic data max size.- Returns:
- the dynamic data max size
-
getTproMappingsOffset
public int getTproMappingsOffset()Returns the tpro mappings offset.- Returns:
- the tpro mappings offset
-
getTproMappingsCount
public int getTproMappingsCount()Returns the tpro mappings count.- Returns:
- the tpro mappings count
-
getReader
Returns the reader associated with the header.- Returns:
- the reader associated with the header
-
getBaseAddress
public long getBaseAddress()Returns the base address of the DYLD cache.This is where the cache should be loaded in memory.
- Returns:
- the base address of the DYLD cache
-
getMappingInfos
Gets theList
ofDyldCacheMappingInfo
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldCacheMappingInfo
s
-
getMappedImages
Generates aList
ofDyldCacheImage
s that are mapped in by thisDyldCacheHeader
. Requires header to have been parsed.NOTE: A DYLD subcache header may declare an image, but that image may get loaded at an address defined by the memory map of a different subcache header. This method will only return the images that are mapped by "this" header's memory map.
- Returns:
- A
List
ofDyldCacheImage
s mapped by thisDyldCacheHeader
-
getSubcacheEntries
Gets theList
ofDyldSubcacheEntry
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldSubcacheEntry
s
-
getCacheMappingAndSlideInfos
Gets theList
ofDyldCacheMappingAndSlideInfo
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldCacheMappingAndSlideInfo
s
-
getLocalSymbolsInfo
Gets theDyldCacheLocalSymbolsInfo
.- Returns:
- The
DyldCacheLocalSymbolsInfo
. Could be null if it didn't parse.
-
getSlideInfos
Gets theList
ofDyldCacheSlideInfoCommon
s.- Returns:
- the
List
ofDyldCacheSlideInfoCommon
s.
-
getBranchPoolAddresses
Gets theList
of branch pool address. Requires header to have been parsed.- Returns:
- The
List
of branch pool address
-
getArchitecture
Gets architecture information.- Returns:
- architecture information
-
toDataType
Description copied from interface:StructConverter
Returns a structure datatype representing the contents of the implementor of this interface.For example, given:
class A { int foo; double bar; }
The return value should be a structure data type with two data type components; an INT and a DOUBLE. The structure should contain field names and, if possible, field comments.
- Specified by:
toDataType
in interfaceStructConverter
- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException
- when a datatype of the same name already existsIOException
- if an IO-related error occurs- See Also:
-
parseLocalSymbolsInfo
public void parseLocalSymbolsInfo(boolean shouldParse, MessageLog log, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
setFileBlock
Sets theMemoryBlock
associated with this header's FILE block.- Parameters:
block
- TheMemoryBlock
associated with this header's FILE block
-
hasSlideInfo
public boolean hasSlideInfo()Checks to see if any slide info exists- Returns:
- True if any slide info exists; otherwise, false
-
unslidLoadAddress
public long unslidLoadAddress()Get the original unslid load address. This is found in the first mapping infos.- Returns:
- the original unslid load address
-
isSubcache
public boolean isSubcache()Checks to see whether or not this is a subcache- Returns:
- True if this is a subcache; otherwise, false if it's a base cache
-
hasAccelerateInfo
public boolean hasAccelerateInfo()Checks to see whether or not the old accelerate info fields are being used- Returns:
- True if the old accelerate info fields are being used; otherwise, false if the new dyldInCache fields are being used
-