In a dSYM file created with Xcode 12.4 or Xcode 12.5 beta 3, it seems that there is no info to link structures that use Codable. Or maybe I missed something? I reported the radar FB9035396 with these info.
Steps to Reproduce:
- Create a codable Swift structure
MyMainStruct
with a member variable of typeMySubStruct
initialized by decoding JSON:
struct MyMainStruct: Codable {
let subStruct: MySubStruct?
enum CodingKeys: String, CodingKey {
case subStruct = "subStruct"
}
init(from decoder: Decoder) throws {
let values = try decoder.container(keyedBy: CodingKeys.self)
subStruct = try values.decodeIfPresent(MySubStruct.self, forKey: .subStruct)
}
}
- Archive the project to generate a dSYM file.
- Run
dwarfdump SimpleSwiftApp.app.dSYM/Contents/Resources/DWARF/SimpleSwiftApp
Result: You can find the declaration of both structures MyMainStruct
and MySubStruct
:
0x00047f16: DW_TAG_structure_type
DW_AT_name ("MyMainStruct")
DW_AT_linkage_name ("$s14SimpleSwiftApp12MyMainStructVD")
DW_AT_byte_size (0x10)
DW_AT_APPLE_runtime_class (DW_LANG_Swift)
[...]
0x00048088: DW_TAG_structure_type
DW_AT_name ("MySubStruct")
DW_AT_linkage_name ("$s14SimpleSwiftApp11MySubStructVD")
DW_AT_byte_size (0x10)
DW_AT_APPLE_runtime_class (DW_LANG_Swift)
It appears however that there are no link between both structures. I would love to know from the dSYM file that MyMainStruct
uses the MySubStruct
structure. Maybe the dSYM file should contain a dwarf::DW_TAG_member
attribute?