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 DyldArchitecturegetArchitecture()Gets architecture information.longgetBaseAddress()Gets the base address of the DYLD cache.java.util.List<java.lang.Long>getBranchPoolAddresses()Gets theListof branch pool address.java.util.List<DyldCacheMappingAndSlideInfo>getCacheMappingAndSlideInfos()Gets theListofDyldCacheMappingAndSlideInfos.intgetImagesCount()Gets the number ofDyldCacheImageInfos.intgetImagesOffset()Gets the file offset to firstDyldCacheImageInfo.DyldCacheLocalSymbolsInfogetLocalSymbolsInfo()Gets theDyldCacheLocalSymbolsInfo.byte[]getMagic()Gets the magic bytes, which contain version information.java.util.List<DyldCacheImage>getMappedImages()java.util.List<DyldCacheMappingInfo>getMappingInfos()Gets theListofDyldCacheMappingInfos.java.util.List<DyldCacheSlideInfoCommon>getSlideInfos()Gets theListofDyldCacheSlideInfoCommons.booleanhaSlideInfo()Checks to see if any slide info existsvoidmarkup(Program program, AddressSpace space, TaskMonitor monitor, MessageLog log)Marks up thisDyldCacheHeaderwith data structures and comments.voidparseFromFile(boolean parseSymbols, 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.DataTypetoDataType()Returns a structure datatype representing the contents of the implementor of this interface.longunslidLoadAddress()Get the original unslid load address.
-
-
-
Constructor Detail
-
DyldCacheHeader
public DyldCacheHeader(BinaryReader reader) throws java.io.IOException
Create a newDyldCacheHeader.- Parameters:
reader- ABinaryReaderpositioned 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 CancelledExceptionParses the structures referenced by thisDyldCacheHeaderfrom 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 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, AddressSpace space, TaskMonitor monitor, MessageLog log) throws CancelledException
Marks up thisDyldCacheHeaderwith data structures and comments.- Parameters:
program- TheProgramto mark upspace- 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
-
getMappingInfos
public java.util.List<DyldCacheMappingInfo> 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
public java.util.List<DyldCacheImage> getMappedImages()
Generates aListofDyldCacheImages 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
ListofDyldCacheImages mapped by thisDyldCacheHeader
-
getCacheMappingAndSlideInfos
public java.util.List<DyldCacheMappingAndSlideInfo> getCacheMappingAndSlideInfos()
Gets theListofDyldCacheMappingAndSlideInfos. Requires header to have been parsed.- Returns:
- The
ListofDyldCacheMappingAndSlideInfos
-
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 theListofDyldCacheSlideInfoCommons.- Returns:
- the
ListofDyldCacheSlideInfoCommons.
-
getBranchPoolAddresses
public java.util.List<java.lang.Long> getBranchPoolAddresses()
Gets theListof branch pool address. Requires header to have been parsed.- Returns:
- The
Listof 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: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 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
-
-