Skip to content

objc ¤

Apple Objective-C Runtime Support

This module implements support for analyzing the Apple Objective-C runtime. As expected, Apple provides no oficial specification for the internal ABI of ObjC and no guarantees of its stability, and so this module is not guaranteed to work on all versions of Darwin.

Classes:

Attributes:

  • T

T module-attribute ¤

T = TypeVar('T')

Object ¤

Object(addr: int)

Attributes:

cls property ¤

cls: Class | None

Class ¤

Class(addr: int)

Bases: Object

Attributes:

superclass property ¤

superclass: Class | None

name property ¤

name: bytes

methods property ¤

methods: Generator[Method]

ivars property ¤

ivars: Generator[InstanceVariable]

properties property ¤

properties: Generator[ClassProperty]

is_metaclass property ¤

is_metaclass: bool

cls property ¤

cls: Class | None

InstanceVariable ¤

InstanceVariable(ptr: int)

An Objective-C Instance Variable.

Instance Variables are NOT objects!

Attributes:

  • offset (int) –

    The offset in bytes of this value from the start of the object instance.

  • name (bytes) –

    The name of this instance variable.

  • typename (bytes) –

    The name of the type of this instance variable.

  • alignment (int) –

    The alignment of this instance variable, in bytes.

  • size (int) –

    The size of this instance variable, in bytes.

offset property ¤

offset: int

The offset in bytes of this value from the start of the object instance.

name property ¤

name: bytes

The name of this instance variable.

typename property ¤

typename: bytes

The name of the type of this instance variable.

alignment property ¤

alignment: int

The alignment of this instance variable, in bytes.

size property ¤

size: int

The size of this instance variable, in bytes.

ClassProperty ¤

ClassProperty(ptr: int)

Attributes:

  • name (bytes) –

    The name of this class property.

  • value (bytes) –

    The value of this property.

name property ¤

name: bytes

The name of this class property.

value property ¤

value: bytes

The value of this property.

Selector ¤

Selector(ptr: int)

An Objective-C Selector.

Selectors are NOT objects!

Attributes:

  • name (bytes) –

    Retrieves the name of this selector.

name property ¤

name: bytes

Retrieves the name of this selector.

Method ¤

Method(ptr: int)

An Objective-C Method Pointer.

Methods are NOT objects!

A method pointer can be one of three types: Small, small direct, and big.

Pointer types are distinguished by the two least significant bits in the integer representation of the pointer. A value of 1 is used for both small pointer types, while all other values are used to distinguish between the signing nuances of big pointers.

Small pointers 32-bit wide and relative to a given base value. Big pointers contain the pointers themselves, and they may or may not be signed.

Small direct pointers are small pointers that reside in the shared cache, and their selectors are relative to @selector(🤯), while the selectors of regular small pointers are relative to the pointers themselves.

Attributes:

  • sel (Selector) –

    The selector this method responds to.

  • types (bytes) –

    The types of the arguments to this method.

  • imp (int) –

    The pointer to the function that implements this method.

sel property ¤

sel: Selector

The selector this method responds to.

types property ¤

types: bytes

The types of the arguments to this method.

imp property ¤

imp: int

The pointer to the function that implements this method.