Skip to content

[vendored] CDStructures.h struct fields (_field1, _field2, ...) carry no semantic meaning and block debuggability #1191

Description

@dariusta

Source

Filed from a downstream consumer (Straton-Labs-LLC/stratton-internal, vendoring WebDriverAgentLib.xcframework).
Tracking ID in our audit: ocr-prelim-07029.

Affected file

WebDriverAgentLib/RodmanRunnerLib/CDStructures.h (vendored header at native/runner/Frameworks/WebDriverAgentLib.xcframework/ios-arm64/RodmanRunnerLib.framework/Headers/CDStructures.h)

Defect

Both struct types in the file use opaque field names:

typedef struct {
    unsigned int _field1;
    unsigned int _field2;
    unsigned int _field3;
    unsigned int _field4;
    unsigned int _field5;
    unsigned int _field6;
    unsigned int _field7;
} CDStruct_a561fd19;

typedef struct {
    unsigned short _field1;
    unsigned short _field2;
    unsigned short _field3[1];
} CDStruct_27a325c0;

The class-dump mangled type names (CDStruct_a561fd19, CDStruct_27a325c0) are MD5-prefixed hashes of the original struct definition. They preserve identity but lose meaning.

Consequences for downstream integrators:

  1. Debuggability is gone. When lldb stops inside a function taking CDStruct_a561fd19, the printed struct is _field1=0x00000003 _field2=0x0000000a _field3=0x00000000 .... There is no hint which field is a tag, which is a count, which is a pointer-shaped integer.
  2. Code review is impossible. Any line that reads instance._field3 cannot be reasoned about without checking the originating header in an Xcode version of the corresponding age.
  3. Future regression risk. When Apple renames an ivar (e.g. Xcode 15 → 16 renamed _XCTestCaseImplementation internals), the struct shape can change silently. Without semantic names the consumer cannot write a compile-time check that detects the drift.

Suggested fix

For fields where the underlying symbol is identifiable (most of them are — class-dump emits _field1 only when the underlying symbol lacks a name; Apple's runtime always has names), restore semantic names:

typedef struct {
    unsigned int version;          // _XCTestCaseImplementation ABI version
    unsigned int flags;
    unsigned int testCaseHash;
    unsigned int failureCount;
    unsigned int skipCount;
    unsigned int expectedDuration; // in seconds
    unsigned int reserved;         // zero on Xcode 15.x; pad on Xcode 16.x
} CDStruct_a561fd19;

For fields that genuinely have no symbol (e.g. compiler-generated padding), keep _reserved or _pad_* to distinguish "intentionally unknown" from "I forgot to rename this".

The MD5-prefixed type names can stay (CDStruct_a561fd19) for ABI compat, but the field names are under the project's control.

Related

This issue compounds ocr-prelim-06853 (missing include guard) — fixing the guard without fixing the field names just makes the opaque struct name visible in more translation units.

Why this matters downstream

Phone-farm debugging depends on lldb being able to print these structs symbolically. Without semantic names, every crash investigation starts with a header archaeology dig.

Metadata

Metadata

Assignees

No one assigned

    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