Package ghidra.app.util.bin.format.macho.dyld

# Class DyldCacheSlideInfoCommon

java.lang.Object
ghidra.app.util.bin.format.macho.dyld.DyldCacheSlideInfoCommon

All Implemented Interfaces:
  `StructConverter`

Direct Known Subclasses:
  `DyldCacheSlideInfo1`, `DyldCacheSlideInfo2`, `DyldCacheSlideInfo3`, `DyldCacheSlideInfo4`

public abstract class DyldCacheSlideInfoCommon extends Object implements StructConverter
Class for representing the common components of the various dyld_cache_slide_info structures. The intent is for the the full dyld_cache_slide_info structures to extend this and add their specific parts.

See Also:
  - dyld_cache_format.h

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `BYTES_PER_CHAIN_OFFSET`
  `static final int`
  `CHAIN_OFFSET_MASK`
  `static final int`
  `DATA_PAGE_MAP_ENTRY`
  `protected long`
  `mappingAddress`
  `protected long`
  `mappingFileOffset`
  `protected long`
  `mappingSize`
  `protected long`
  `slideInfoOffset`
  `protected int`
  `version`

  ### Fields inherited from interface ghidra.app.util.bin.StructConverter

  `ASCII, BYTE, DWORD, IBO32, IBO64, POINTER, QWORD, SLEB128, STRING, ULEB128, UTF16, UTF8, VOID, WORD`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DyldCacheSlideInfoCommon(BinaryReader reader, long mappingAddress, long mappingSize, long mappingFileOffset)`
  Create a new `DyldCacheSlideInfoCommon`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `fixupSlidePointers(Program program, boolean markup, boolean addRelocations, MessageLog log, TaskMonitor monitor)`
  Fixes up the programs slide pointers
  `long`
  `getMappingAddress()`
  Returns The base address of where the slide fixups will take place.
  `long`
  `getMappingFileOffset()`
  Returns The base file offset of where the slide fixups will take place.
  `long`
  `getMappingSize()`
  Returns The size of the slide fixups block.
  `abstract List<DyldCacheSlideFixup>`
  `getSlideFixups(BinaryReader reader, int pointerSize, MessageLog log, TaskMonitor monitor)`
  Walks the slide fixup information and collects a `List` of `DyldCacheSlideFixup`s that will need to be applied to the image
  `long`
  `getSlideInfoOffset()`
  Returns The original slide info offset.
  `int`
  `getVersion()`
  Returns The version of the DYLD slide info.
  `static DyldCacheSlideInfoCommon`
  `parseSlideInfo(BinaryReader reader, long slideInfoOffset, long mappingAddress, long mappingSize, long mappingFileOffset, MessageLog log, TaskMonitor monitor)`
  Parses the slide info
  `DataType`
  `toDataType()`
  Returns a structure datatype representing the contents of the implementor of this interface.

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

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

- ## Field Details

  - ### DATA_PAGE_MAP_ENTRY

    public static final int DATA_PAGE_MAP_ENTRY
    See Also:
      - Constant Field Values

  - ### BYTES_PER_CHAIN_OFFSET

    public static final int BYTES_PER_CHAIN_OFFSET
    See Also:
      - Constant Field Values

  - ### CHAIN_OFFSET_MASK

    public static final int CHAIN_OFFSET_MASK
    See Also:
      - Constant Field Values

  - ### version

    protected int version

  - ### slideInfoOffset

    protected long slideInfoOffset

  - ### mappingAddress

    protected long mappingAddress

  - ### mappingSize

    protected long mappingSize

  - ### mappingFileOffset

    protected long mappingFileOffset

- ## Constructor Details

  - ### DyldCacheSlideInfoCommon

    public DyldCacheSlideInfoCommon(BinaryReader reader, long mappingAddress, long mappingSize, long mappingFileOffset) throws IOException
    Create a new `DyldCacheSlideInfoCommon`.
    Parameters:
      `reader` - A `BinaryReader` positioned at the start of a DYLD slide info
      `mappingAddress` - The base address of where the slide fixups will take place
      `mappingSize` - The size of the slide fixups block
      `mappingFileOffset` - The base file offset of where the slide fixups will take place
    Throws:
      `IOException` - if there was an IO-related problem creating the DYLD slide info

- ## Method Details

  - ### parseSlideInfo

    public static DyldCacheSlideInfoCommon parseSlideInfo(BinaryReader reader, long slideInfoOffset, long mappingAddress, long mappingSize, long mappingFileOffset, MessageLog log, TaskMonitor monitor)
    Parses the slide info
    Parameters:
      `reader` - A `BinaryReader` positioned at the start of a DYLD slide info
      `slideInfoOffset` - The offset of the slide info to parse
      `mappingAddress` - The base address of where the slide fixups will take place
      `mappingSize` - The size of the slide fixups block
      `mappingFileOffset` - The base file offset of where the slide fixups will take place
      `log` - The log
      `monitor` - A cancelable task monitor
    Returns:
      The slide info object

  - ### getVersion

    public int getVersion()
    Returns The version of the DYLD slide info.
    Returns:
      The version of the DYLD slide info

  - ### getSlideInfoOffset

    public long getSlideInfoOffset()
    Returns The original slide info offset.
    Returns:
      The original slide info offset

  - ### getMappingAddress

    public long getMappingAddress()
    Returns The base address of where the slide fixups will take place.
    Returns:
      The base address of where the slide fixups will take place

  - ### getMappingSize

    public long getMappingSize()
    Returns The size of the slide fixups block.
    Returns:
      The size of the slide fixups block

  - ### getMappingFileOffset

    public long getMappingFileOffset()
    Returns The base file offset of where the slide fixups will take place.
    Returns:
      The base file offset of where the slide fixups will take place

  - ### getSlideFixups

    public abstract List<DyldCacheSlideFixup> getSlideFixups(BinaryReader reader, int pointerSize, MessageLog log, TaskMonitor monitor) throws IOException, CancelledException
    Walks the slide fixup information and collects a `List` of `DyldCacheSlideFixup`s that will need to be applied to the image
    Parameters:
      `reader` - A `BinaryReader` positioned at the start of the segment to fix up
      `pointerSize` - The size of a pointer in bytes
      `log` - The log
      `monitor` - A cancellable monitor
    Returns:
      A `List` of `DyldCacheSlideFixup`s
    Throws:
      `IOException` - If there was an IO-related issue
      `CancelledException` - If the user cancelled the operation

  - ### fixupSlidePointers

    public void fixupSlidePointers(Program program, boolean markup, boolean addRelocations, MessageLog log, TaskMonitor monitor) throws MemoryAccessException, CancelledException
    Fixes up the programs slide pointers
    Parameters:
      `program` - The `Program`
      `markup` - True if the slide pointers should be marked up; otherwise, false
      `addRelocations` - True if slide pointer locations should be added to the relocation table; otherwise, false
      `log` - The log
      `monitor` - A cancellable monitor
    Throws:
      `MemoryAccessException` - If there was a problem accessing memory
      `CancelledException` - If the user cancelled the operation

  - ### toDataType

    public DataType toDataType() throws DuplicateNameException, 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 interface `StructConverter`
    Returns:
      returns a structure datatype representing the implementor of this interface
    Throws:
      `DuplicateNameException` - when a datatype of the same name already exists
      `IOException`
    See Also:
      - `StructureDataType`