Class DyldCacheHeader
- java.lang.Object
-
- ghidra.app.util.bin.format.macho.dyld.DyldCacheHeader
-
- All Implemented Interfaces:
StructConverter
public class DyldCacheHeader extends java.lang.Object implements StructConverter
Represents a dyld_cache_header structure.- See Also:
- dyld3/shared-cache/dyld_cache_format.h
-
-
Constructor Summary
Constructors Constructor Description DyldCacheHeader(BinaryReader reader)
Create a newDyldCacheHeader
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DyldArchitecture
getArchitecture()
Gets architecture information.long
getBaseAddress()
Gets the base address of the DYLD cache.java.util.List<java.lang.Long>
getBranchPoolAddresses()
Gets theList
of branch pool address.java.util.List<DyldCacheMappingAndSlideInfo>
getCacheMappingAndSlideInfos()
Gets theList
ofDyldCacheMappingAndSlideInfo
s.int
getImagesCount()
Gets the number ofDyldCacheImageInfo
s.int
getImagesOffset()
Gets the file offset to firstDyldCacheImageInfo
.DyldCacheLocalSymbolsInfo
getLocalSymbolsInfo()
Gets theDyldCacheLocalSymbolsInfo
.byte[]
getMagic()
Gets the magic bytes, which contain version information.java.util.List<DyldCacheImage>
getMappedImages()
java.util.List<DyldCacheMappingInfo>
getMappingInfos()
Gets theList
ofDyldCacheMappingInfo
s.java.util.List<DyldCacheSlideInfoCommon>
getSlideInfos()
Gets theList
ofDyldCacheSlideInfoCommon
s.boolean
haSlideInfo()
Checks to see if any slide info existsvoid
markup(Program program, AddressSpace space, TaskMonitor monitor, MessageLog log)
Marks up thisDyldCacheHeader
with data structures and comments.void
parseFromFile(boolean parseSymbols, 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.DataType
toDataType()
Returns a structure datatype representing the contents of the implementor of this interface.long
unslidLoadAddress()
Get the original unslid load address.
-
-
-
Constructor Detail
-
DyldCacheHeader
public DyldCacheHeader(BinaryReader reader) throws java.io.IOException
Create a newDyldCacheHeader
.- Parameters:
reader
- ABinaryReader
positioned at the start of a DYLD cache header- Throws:
java.io.IOException
- if there was an IO-related problem creating the DYLD cache header
-
-
Method Detail
-
parseFromFile
public void parseFromFile(boolean parseSymbols, MessageLog log, TaskMonitor monitor) throws CancelledException
Parses the structures referenced by thisDyldCacheHeader
from a file.- Parameters:
parseSymbols
- True if symbols should be parsed (could be very slow); 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, AddressSpace space, TaskMonitor monitor, MessageLog log) throws CancelledException
Marks up thisDyldCacheHeader
with data structures and comments.- Parameters:
program
- TheProgram
to mark upspace
- 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
-
getMappingInfos
public java.util.List<DyldCacheMappingInfo> 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
public java.util.List<DyldCacheImage> getMappedImages()
Generates aList
ofDyldCacheImage
s that are mapped in by thisDyldCacheHeader
. Requires header to have been parsed.NOTE: A "split" DYLD Cache header may declare an image, but that image may get loaded at an address defined by the memory map of a different split 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
-
getCacheMappingAndSlideInfos
public java.util.List<DyldCacheMappingAndSlideInfo> getCacheMappingAndSlideInfos()
Gets theList
ofDyldCacheMappingAndSlideInfo
s. Requires header to have been parsed.- Returns:
- The
List
ofDyldCacheMappingAndSlideInfo
s
-
getLocalSymbolsInfo
public DyldCacheLocalSymbolsInfo getLocalSymbolsInfo()
Gets theDyldCacheLocalSymbolsInfo
.- Returns:
- The
DyldCacheLocalSymbolsInfo
. Could be be null if it didn't parse.
-
getSlideInfos
public java.util.List<DyldCacheSlideInfoCommon> getSlideInfos()
Gets theList
ofDyldCacheSlideInfoCommon
s.- Returns:
- the
List
ofDyldCacheSlideInfoCommon
s.
-
getBranchPoolAddresses
public java.util.List<java.lang.Long> getBranchPoolAddresses()
Gets theList
of branch pool address. Requires header to have been parsed.- Returns:
- The
List
of branch pool address
-
getArchitecture
public DyldArchitecture getArchitecture()
Gets architecture information.- Returns:
- architecture information
-
toDataType
public DataType toDataType() throws DuplicateNameException, java.io.IOException
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 existsjava.io.IOException
- See Also:
StructureDataType
-
haSlideInfo
public boolean haSlideInfo()
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
-
-