(Arch, Struct, Cursor)
| 316 | return Arch |
| 317 | |
| 318 | def HandleStructElements(Arch, Struct, Cursor): |
| 319 | for Child in Cursor.get_children(): |
| 320 | # logging.info ("\t\tStruct/Union Children: Cursor \"{0}{1}\" of kind {2}".format(Arch.CurrentNamespace, Child.spelling, Child.kind)) |
| 321 | if (Child.kind == CursorKind.ANNOTATE_ATTR): |
| 322 | if (Child.spelling.startswith("alias-")): |
| 323 | Sections = Child.spelling.split("-") |
| 324 | if (Sections[1] == "x86_32"): |
| 325 | Struct.Aliases.append(AliasType(Sections[2], AliasType.ALIAS_X86_32)) |
| 326 | elif (Sections[1] == "x86_64"): |
| 327 | Struct.Aliases.append(AliasType(Sections[2], AliasType.ALIAS_X86_64)) |
| 328 | elif (Sections[1] == "aarch64"): |
| 329 | Struct.Aliases.append(AliasType(Sections[2], AliasType.ALIAS_AARCH64)) |
| 330 | elif (Sections[1] == "win32"): |
| 331 | Struct.Aliases.append(AliasType(Sections[2], AliasType.ALIAS_WIN32)) |
| 332 | elif (Sections[1] == "win64"): |
| 333 | Struct.Aliases.append(AliasType(Sections[2], AliasType.ALIAS_WIN64)) |
| 334 | else: |
| 335 | logging.critical ("Can't handle alias type '{0}'".format(Child.spelling)) |
| 336 | Arch.Parsed = False |
| 337 | |
| 338 | elif (Child.spelling == "fex-match"): |
| 339 | Struct.ExpectFEXMatch = True |
| 340 | else: |
| 341 | # Unknown annotation |
| 342 | pass |
| 343 | elif (Child.kind == CursorKind.FIELD_DECL): |
| 344 | ParentType = Cursor.type |
| 345 | FieldType = Child.type |
| 346 | Field = FieldDefinition( |
| 347 | Name = Child.spelling, |
| 348 | Size = FieldType.get_size(), |
| 349 | OffsetOf = ParentType.get_offset(Child.spelling), |
| 350 | Alignment = FieldType.get_align()) |
| 351 | |
| 352 | #logging.info ("\t{0}".format(Child.spelling)) |
| 353 | #logging.info ("\t\tSize of type: {0}".format(FieldType.get_size())); |
| 354 | #logging.info ("\t\tAlignment of type: {0}".format(FieldType.get_align())); |
| 355 | #logging.info ("\t\tOffsetof of type: {0}".format(ParentType.get_offset(Child.spelling))); |
| 356 | Struct.Members.append(Field) |
| 357 | Arch.FieldDecls.append(Field) |
| 358 | elif (Child.kind == CursorKind.STRUCT_DECL): |
| 359 | ParentType = Cursor.type |
| 360 | FieldType = Child.type |
| 361 | Field = FieldDefinition( |
| 362 | Name = Child.spelling, |
| 363 | Size = FieldType.get_size(), |
| 364 | OffsetOf = ParentType.get_offset(Child.spelling), |
| 365 | Alignment = FieldType.get_align()) |
| 366 | |
| 367 | #logging.info ("\t{0}".format(Child.spelling)) |
| 368 | #logging.info ("\t\tSize of type: {0}".format(FieldType.get_size())); |
| 369 | #logging.info ("\t\tAlignment of type: {0}".format(FieldType.get_align())); |
| 370 | #logging.info ("\t\tOffsetof of type: {0}".format(ParentType.get_offset(Child.spelling))); |
| 371 | Struct.Members.append(Field) |
| 372 | Arch.FieldDecls.append(Field) |
| 373 | Arch = HandleStructDeclCursor(Arch, Child) |
| 374 | elif (Child.kind == CursorKind.UNION_DECL): |
| 375 | Struct = HandleStructElements(Arch, Struct, Child) |
no test coverage detected