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 TypeMethodDescriptionGets architecture information.longGets the base address of the DYLD cache.Gets theListof branch pool address.Gets theListofDyldCacheMappingAndSlideInfos.Gets the DYLD entry point address (if known)intGets the number ofDyldCacheImageInfos.intGets the file offset to firstDyldCacheImageInfo.Gets theDyldCacheLocalSymbolsInfo.byte[]getMagic()Gets the magic bytes, which contain version information.Gets theListofDyldCacheMappingInfos.Gets theListofDyldCacheSlideInfoCommons.Gets theListofDyldSubcacheEntrys.Gets the symbol file UUID inStringformgetUUID()Gets the UUID inStringformbooleanChecks to see whether or not the old accelerate info fields are being usedbooleanChecks to see if any slide info existsbooleanChecks to see whether or not this is a subcachevoidmarkup(Program program, boolean markupLocalSymbols, AddressSpace space, TaskMonitor monitor, MessageLog log) Marks up thisDyldCacheHeaderwith data structures and comments.voidparseFromFile(boolean parseLocalSymbols, MessageLog log, TaskMonitor monitor) Parses the structures referenced by thisDyldCacheHeaderfrom a file.voidparseFromMemory(Program program, AddressSpace space, MessageLog log, TaskMonitor monitor) Parses the structures referenced by thisDyldCacheHeaderfrom memory.voidparseLocalSymbolsInfo(boolean shouldParse, MessageLog log, TaskMonitor monitor) voidsetFileBlock(MemoryBlock block) Sets theMemoryBlockassociated with this header's FILE block.Returns a structure datatype representing the contents of the implementor of this interface.longGet the original unslid load address.
-
Constructor Details
-
DyldCacheHeader
Create a newDyldCacheHeader.- Parameters:
reader- ABinaryReaderpositioned 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 thisDyldCacheHeaderfrom 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 thisDyldCacheHeaderfrom memory.- Parameters:
program- TheProgramwhose memory to parsespace- TheProgram'sAddressSpacelog- 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 thisDyldCacheHeaderwith data structures and comments.- Parameters:
program- TheProgramto mark upmarkupLocalSymbols- True if the local symbols should be marked up; otherwise, falsespace- TheProgram'sAddressSpacemonitor- A cancellable task monitorlog- The log- Throws:
CancelledException- if the user cancelled the operation
-
getBaseAddress
public long getBaseAddress()Gets 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
-
getMagic
public byte[] getMagic()Gets the magic bytes, which contain version information.- Returns:
- The magic bytes
-
getUUID
Gets the UUID inStringform- Returns:
- The UUID in
Stringform, or null if a UUID is not defined
-
getEntryPoint
Gets the DYLD entry point address (if known)- Returns:
- The DYLD entry point address, or null if it is not known
-
getMappingInfos
Gets theListofDyldCacheMappingInfos. Requires header to have been parsed.- Returns:
- The
ListofDyldCacheMappingInfos
-
getImagesOffset
public int getImagesOffset()Gets the file offset to firstDyldCacheImageInfo.- Returns:
- The file offset to first
DyldCacheImageInfo
-
getImagesCount
public int getImagesCount()Gets the number ofDyldCacheImageInfos.- Returns:
- The number of
DyldCacheImageInfos
-
getMappedImages
Generates aListofDyldCacheImages 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
ListofDyldCacheImages mapped by thisDyldCacheHeader
-
getSubcacheEntries
Gets theListofDyldSubcacheEntrys. Requires header to have been parsed.- Returns:
- The
ListofDyldSubcacheEntrys
-
getSymbolFileUUID
Gets the symbol file UUID inStringform- Returns:
- The symbol file UUID in
Stringform, or null if a symbol file UUID is not defined or is all zeros
-
getCacheMappingAndSlideInfos
Gets theListofDyldCacheMappingAndSlideInfos. Requires header to have been parsed.- Returns:
- The
ListofDyldCacheMappingAndSlideInfos
-
getLocalSymbolsInfo
Gets theDyldCacheLocalSymbolsInfo.- Returns:
- The
DyldCacheLocalSymbolsInfo. Could be be null if it didn't parse.
-
getSlideInfos
Gets theListofDyldCacheSlideInfoCommons.- Returns:
- the
ListofDyldCacheSlideInfoCommons.
-
getBranchPoolAddresses
Gets theListof branch pool address. Requires header to have been parsed.- Returns:
- The
Listof branch pool address
-
getArchitecture
Gets architecture information.- Returns:
- architecture information
-
toDataType
Description copied from interface:StructConverterReturns 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:
toDataTypein interfaceStructConverter- Returns:
- returns a structure datatype representing the implementor of this interface
- Throws:
DuplicateNameException- when a datatype of the same name already existsIOException- See Also:
-
parseLocalSymbolsInfo
public void parseLocalSymbolsInfo(boolean shouldParse, MessageLog log, TaskMonitor monitor) throws CancelledException - Throws:
CancelledException
-
setFileBlock
Sets theMemoryBlockassociated with this header's FILE block.- Parameters:
block- TheMemoryBlockassociated 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
-