Problem
C++ class hierarchies produce deeply nested struct member access chains in decompiled output:
((log_path.d)->super_QArrayData).ref.atomic._q_value.super___atomic_base<int>._M_i
Expected (flattened):
log_path.d->ref.atomic._q_value._M_i
Root Cause
Ghidra represents C++ base classes as synthesized struct fields named super_BaseClass. The serializer faithfully emits these, and the Clang AST preserves the full chain. No flattening or inheritance-aware processing exists.
Example Ghidra type hierarchy:
struct QString { Data *d; }
struct Data : QArrayData { ... } → field: super_QArrayData
struct QArrayData { RefCount ref; }
struct RefCount { QBasicAtomicInt atomic; }
struct QBasicAtomicInt : __atomic_base<int> → field: super___atomic_base<int>
Proposed Fix
In TypeBuilder::complete_definition(), when processing composite type fields:
Option A (Simple): Strip super_ prefix from field names → QArrayData.ref instead of super_QArrayData.ref
Option B (Better): Detect super_* fields and inline the base struct's fields at the same offset, flattening the hierarchy entirely
Files
lib/patchestry/AST/TypeBuilder.cpp — complete_definition() field processing
include/patchestry/Ghidra/PcodeTypes.hpp — CompositeType::Component
Problem
C++ class hierarchies produce deeply nested struct member access chains in decompiled output:
Expected (flattened):
Root Cause
Ghidra represents C++ base classes as synthesized struct fields named
super_BaseClass. The serializer faithfully emits these, and the Clang AST preserves the full chain. No flattening or inheritance-aware processing exists.Example Ghidra type hierarchy:
Proposed Fix
In
TypeBuilder::complete_definition(), when processing composite type fields:Option A (Simple): Strip
super_prefix from field names →QArrayData.refinstead ofsuper_QArrayData.refOption B (Better): Detect
super_*fields and inline the base struct's fields at the same offset, flattening the hierarchy entirelyFiles
lib/patchestry/AST/TypeBuilder.cpp—complete_definition()field processinginclude/patchestry/Ghidra/PcodeTypes.hpp—CompositeType::Component