Skip to content

Feature Request: Output Field Offsets, VTable Offsets, and Protocol Witness Offsets #18

@WeZZard

Description

@WeZZard

Hi 👋 and thanks for the amazing tool — it’s been incredibly helpful for reverse engineering Swift binaries.

I’d like to propose a feature request that would significantly enhance the tool’s utility for advanced reverse engineering workflows, especially when analyzing Swift programs.

Feature Request

Would it be possible to add support for extracting and displaying the following offsets in the generated output?

  1. Data Field Offsets
    The memory offset of each data field (instance variable) within a Swift class or struct.

2.Virtual Function Offsets in the V-table
The offset of each virtual function within the class v-table — useful for analyzing dynamic dispatch behavior.

  1. Protocol Witness Offsets in the Protocol Witness Table (PWT)
    The relative position of each protocol requirement implementation inside the protocol witness table — which is critical for reconstructing existential calling conventions.

Why This Matters:

Having these offsets would allow reverse engineers to:

  1. Match memory layout more precisely when reconstructing Swift types and method tables.
  2. Understand subclassing and protocol conformance behavior at the binary level.
  3. Navigate low-level call sites that rely on indirect calls via v-tables or protocol witness tables.

Example Use Case

We can quickly know about what a particular offset of the type metadata and protocol witness table mean when reading disassembly code.

Possible Output Format

This could be an optional flag like --emit-offsets or a new section in the output format, such as:

class MyModule.MyClass {
  // field offset: 0x10
  var foo: Int
  // v-table function: 0x18
  fun bar()
}
protocol MyModule.MyProtocol {
  // protocol witness table offset: 0x8
  fun bar()
}

Let me know if this is something you’d consider! I’d be happy to discuss implementation ideas or provide further use cases.

Thanks again for your awesome work 🙌

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions