Package ghidra.app.util.bin.format.objectiveC

# Class ObjectiveC1_Utilities

java.lang.Object
ghidra.app.util.bin.format.objectiveC.ObjectiveC1_Utilities

public final class ObjectiveC1_Utilities extends Object

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObjectiveC1_Utilities()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `applyData(Program program, DataType dt, Address address)`
  Applies the data type at the specified address.
  `static void`
  `clear(ObjectiveC2_State state, MemoryBlock block)`
  Clears the code units defined in the given memory block.
  `static final void`
  `createInstanceVariablesC2_OBJC2(ObjectiveC2_State state)`
  `static final void`
  `createMethods(ObjectiveC1_State state)`
  `static Namespace`
  `createNamespace(Program program, String... namespacePath)`
  Creates a namespace hierarchy using the list of strings specified in namespacePath.
  `static Address`
  `createPointerAndReturnAddressBeingReferenced(Program program, Address address)`
  Applies a pointer data type at the specified address and returns the address being referenced.
  `static String`
  `createString(Program program, Address address)`
  Applies a string data type at the specified address and returns the string object.
  `static Symbol`
  `createSymbol(Program program, Namespace parentNamespace, String symbolName, Address symbolAddress)`
  Creates a symbol.
  `static String`
  `dereferenceAsciiString(BinaryReader reader, boolean is32bit)`
  Dereferences a string pointer and returns the string.
  `static final void`
  `fixupReferences(ObjectiveC1_State state)`
  This method will remove references to the NULL address and it will adjust THUMB references to no longer be offcut.
  `static final String`
  `formatAsObjectiveC(Function function, ObjectiveC_MethodType methodType)`
  `static final String`
  `formatAsObjectiveC(FunctionSignature signature, ObjectiveC_MethodType methodType, boolean appendSemicolon)`
  `static Namespace`
  `getClassNamespace(Program program, Namespace parentNamespace, String namespaceName)`
  Returns the class inside the given parent name space.
  `static boolean`
  `isNull(Address address)`
  Returns true if the given address is zero.
  `static boolean`
  `isThumb(Program program, long address)`
  Returns true if the address is THUMB code.
  `static boolean`
  `isThumb(Program program, Address address)`
  Returns true if the address is THUMB code.
  `static long`
  `readNextIndex(BinaryReader reader, boolean is32bit)`
  Reads the next index value.
  `static void`
  `setThumbBit(ObjectiveC1_State state, Address address)`
  If needed, sets the TMode bit at the specified address.
  `static Address`
  `toAddress(Program program, long offset)`
  Manufactures an address from the given long.

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

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

- ## Constructor Details

  - ### ObjectiveC1_Utilities

    public ObjectiveC1_Utilities()

- ## Method Details

  - ### clear

    public static void clear(ObjectiveC2_State state, MemoryBlock block) throws Exception
    Clears the code units defined in the given memory block.
    Throws:
      `Exception`

  - ### readNextIndex

    public static long readNextIndex(BinaryReader reader, boolean is32bit) throws IOException
    Reads the next index value. If is32bit is true, then 4 bytes will be read to form index. Otherwise, 8 bytes will be read to form index.
    Throws:
      `IOException`

  - ### dereferenceAsciiString

    public static String dereferenceAsciiString(BinaryReader reader, boolean is32bit) throws IOException
    Dereferences a string pointer and returns the string. If 32-bit only reads a 32-bit pointer.
    Throws:
      `IOException`

  - ### isNull

    public static boolean isNull(Address address)
    Returns true if the given address is zero.

  - ### isThumb

    public static boolean isThumb(Program program, Address address)
    Returns true if the address is THUMB code.

  - ### isThumb

    public static boolean isThumb(Program program, long address)
    Returns true if the address is THUMB code.

  - ### setThumbBit

    public static void setThumbBit(ObjectiveC1_State state, Address address)
    If needed, sets the TMode bit at the specified address.

  - ### toAddress

    public static Address toAddress(Program program, long offset)
    Manufactures an address from the given long.

  - ### applyData

    public static void applyData(Program program, DataType dt, Address address) throws CodeUnitInsertionException
    Applies the data type at the specified address.
    Throws:
      `CodeUnitInsertionException`

  - ### createString

    public static String createString(Program program, Address address)
    Applies a string data type at the specified address and returns the string object.

  - ### createPointerAndReturnAddressBeingReferenced

    public static Address createPointerAndReturnAddressBeingReferenced(Program program, Address address) throws CodeUnitInsertionException
    Applies a pointer data type at the specified address and returns the address being referenced.
    Throws:
      `CodeUnitInsertionException`

  - ### getClassNamespace

    public static Namespace getClassNamespace(Program program, Namespace parentNamespace, String namespaceName) throws DuplicateNameException, InvalidInputException
    Returns the class inside the given parent name space. If it does not exist, then create it and return it.
    Throws:
      `DuplicateNameException`
      `InvalidInputException`

  - ### createSymbol

    public static Symbol createSymbol(Program program, Namespace parentNamespace, String symbolName, Address symbolAddress) throws InvalidInputException
    Creates a symbol. TODO - make symbols primary?
    Throws:
      `InvalidInputException`

  - ### createNamespace

    public static Namespace createNamespace(Program program, String... namespacePath) throws DuplicateNameException, InvalidInputException
    Creates a namespace hierarchy using the list of strings specified in namespacePath.
    Throws:
      `DuplicateNameException`
      `InvalidInputException`

  - ### formatAsObjectiveC

    public static final String formatAsObjectiveC(Function function, ObjectiveC_MethodType methodType)

  - ### formatAsObjectiveC

    public static final String formatAsObjectiveC(FunctionSignature signature, ObjectiveC_MethodType methodType, boolean appendSemicolon) throws IllegalStateException
    Throws:
      `IllegalStateException`

  - ### createMethods

    public static final void createMethods(ObjectiveC1_State state)

  - ### createInstanceVariablesC2_OBJC2

    public static final void createInstanceVariablesC2_OBJC2(ObjectiveC2_State state)

  - ### fixupReferences

    public static final void fixupReferences(ObjectiveC1_State state)
    This method will remove references to the NULL address and it will adjust THUMB references to no longer be offcut.