Package ghidra.app.util.opinion

# Class DyldCacheUtils.SplitDyldCache

java.lang.Object
ghidra.app.util.opinion.DyldCacheUtils.SplitDyldCache

All Implemented Interfaces:
  `Closeable`, `AutoCloseable`

Enclosing class:
  `DyldCacheUtils`

public static class DyldCacheUtils.SplitDyldCache extends Object implements Closeable
Class to store a "split" DYLD Cache, which is split across several subcache files (base file, .1, .2, .symbols, etc).

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SplitDyldCache(ByteProvider baseProvider, boolean shouldProcessLocalSymbols, MessageLog log, TaskMonitor monitor)`
  Creates a new `DyldCacheUtils.SplitDyldCache`
  `SplitDyldCache(List<ByteProvider> providers, List<DyldCacheHeader> headers, List<String> names, MessageLog log, TaskMonitor monitor)`
  Creates a new `DyldCacheUtils.SplitDyldCache`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  `long`
  `getBaseAddress()`
  Gets the base address of the split DYLD cache.
  `DyldCacheHeader`
  `getDyldCacheHeader(int i)`
  Gets the i'th `DyldCacheHeader` in the split DYLD Cache
  `List<DyldCacheUtils.DyldCacheImageRecord>`
  `getImageRecords()`
  Gets all the `DyldCacheUtils.DyldCacheImageRecord`s from the entire cache
  `DyldCacheLocalSymbolsInfo`
  `getLocalSymbolInfo()`
  Gets the `DyldCacheLocalSymbolsInfo` from the split DYLD Cache files
  `MachHeader`
  `getMacho(DyldCacheUtils.DyldCacheImageRecord imageRecord)`
  Gets the Mach-O of the given `DyldCacheUtils.DyldCacheImageRecord`.
  `String`
  `getName(int i)`
  Gets the i'th `name` in the split DYLD Cache
  `ByteProvider`
  `getProvider(int i)`
  Gets the i'th `ByteProvider` in the split DYLD Cache
  `int`
  `size()`
  Gets the number of split DYLD Cache files

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SplitDyldCache

    public SplitDyldCache(ByteProvider baseProvider, boolean shouldProcessLocalSymbols, MessageLog log, TaskMonitor monitor) throws IOException, CancelledException
    Creates a new `DyldCacheUtils.SplitDyldCache`
    Parameters:
      `baseProvider` - The `ByteProvider` of the "base" DYLD Cache file
      `shouldProcessLocalSymbols` - True if local symbols should be processed; otherwise, false
      `log` - The log
      `monitor` - A cancelable task monitor
    Throws:
      `IOException` - If there was an IO-related issue with processing the split DYLD Cache
      `CancelledException` - If the user canceled the operation

  - ### SplitDyldCache

    public SplitDyldCache(List<ByteProvider> providers, List<DyldCacheHeader> headers, List<String> names, MessageLog log, TaskMonitor monitor)
    Creates a new `DyldCacheUtils.SplitDyldCache`
    Parameters:
      `providers` - The cache's ordered `ByteProvider`s
      `headers` - The cache's ordered `DyldCacheHeader`s
      `names` - The cache's ordered names
      `log` - The log
      `monitor` - A cancelable task monitor

- ## Method Details

  - ### getProvider

    public ByteProvider getProvider(int i)
    Gets the i'th `ByteProvider` in the split DYLD Cache
    Parameters:
      `i` - The index of the `ByteProvider` to get
    Returns:
      The i'th `ByteProvider` in the split DYLD Cache

  - ### getDyldCacheHeader

    public DyldCacheHeader getDyldCacheHeader(int i)
    Gets the i'th `DyldCacheHeader` in the split DYLD Cache
    Parameters:
      `i` - The index of the `DyldCacheHeader` to get
    Returns:
      The i'th `DyldCacheHeader` in the split DYLD Cache

  - ### getName

    public String getName(int i)
    Gets the i'th `name` in the split DYLD Cache
    Parameters:
      `i` - The index of the `name` to get
    Returns:
      The i'th `name` in the split DYLD Cache

  - ### size

    public int size()
    Gets the number of split DYLD Cache files
    Returns:
      The number of split DYLD Cache files

  - ### getBaseAddress

    public long getBaseAddress()
    Gets the base address of the split DYLD cache. This is where the cache should be loaded in memory.
    Returns:
      The base address of the split DYLD cache

  - ### getLocalSymbolInfo

    public DyldCacheLocalSymbolsInfo getLocalSymbolInfo()
    Gets the `DyldCacheLocalSymbolsInfo` from the split DYLD Cache files
    Returns:
      The `DyldCacheLocalSymbolsInfo` from the split DYLD Cache files, or null if no local symbols are defined

  - ### getImageRecords

    public List<DyldCacheUtils.DyldCacheImageRecord> getImageRecords()
    Gets all the `DyldCacheUtils.DyldCacheImageRecord`s from the entire cache
    Returns:
      A `List` of `DyldCacheUtils.DyldCacheImageRecord`s from the entire cache

  - ### getMacho

    public MachHeader getMacho(DyldCacheUtils.DyldCacheImageRecord imageRecord) throws MachException, IOException
    Gets the Mach-O of the given `DyldCacheUtils.DyldCacheImageRecord`.

    NOTE: The returned Mach-O is not yet `parsed`.

    Parameters:
      `imageRecord` - The desired Mach-O's `DyldCacheUtils.DyldCacheImageRecord`
    Returns:
      The `DyldCacheUtils.DyldCacheImageRecord`'s Mach-O
    Throws:
      `MachException` - If there was a problem creating the `MachHeader`
      `IOException` - If there was an IO-related error

  - ### close

    public void close() throws IOException
    Specified by:
      `close` in interface `AutoCloseable`
    Specified by:
      `close` in interface `Closeable`
    Throws:
      `IOException`