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
-
Method Summary
Modifier and TypeMethodDescriptionGets architecture information.long
Gets the base address of the DYLD cache.Gets theList
of branch pool address.Gets theList
ofDyldCacheMappingAndSlideInfo
s.Gets the DYLD entry point address (if known)int
Gets the number ofDyldCacheImageInfo
s.int
Gets the file offset to firstDyldCacheImageInfo
.Gets theDyldCacheLocalSymbolsInfo
.byte[]
getMagic()
Gets the magic bytes, which contain version information.Gets theList
ofDyldCacheMappingInfo
s.Gets theList
ofDyldCacheSlideInfoCommon
s.Gets theList
ofDyldSubcacheEntry
s.Gets the symbol file UUID inString
formgetUUID()
Gets the UUID inString
formboolean
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
-
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 inString
form- Returns:
- The UUID in
String
form, 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 theList
ofDyldCacheMappingInfo
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldCacheMappingInfo
s
-
getImagesOffset
public int getImagesOffset()Gets the file offset to firstDyldCacheImageInfo
.- Returns:
- The file offset to first
DyldCacheImageInfo
-
getImagesCount
public int getImagesCount()Gets the number ofDyldCacheImageInfo
s.- Returns:
- The number of
DyldCacheImageInfo
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
-
getSymbolFileUUID
Gets the symbol file UUID inString
form- Returns:
- The symbol file UUID in
String
form, or null if a symbol file UUID is not defined or is all zeros
-
getCacheMappingAndSlideInfos
Gets theList
ofDyldCacheMappingAndSlideInfo
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldCacheMappingAndSlideInfo
s
-
getLocalSymbolsInfo
Gets theDyldCacheLocalSymbolsInfo
.- Returns:
- The
DyldCacheLocalSymbolsInfo
. Could be 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
-