3.26 --fieldoffsets

Prints a list of assembly language EQU directives that equate C++ class or C structure field names to their offsets from the base of the class or structure.

Usage

The input ELF file can be a relocatable object or an image.

Use --output to redirect the output to a file. Use the INCLUDE command from armasm to load the produced file and provide access to C++ classes and C structure members by name from assembly language.

This option outputs all structure information. To output a subset of the structures, use --select select_options.

If you do not require a file that can be input to armasm, use the --text -a options to format the display addresses in a more readable form. The -a option only outputs address information for structures and static data in images because the addresses are not known in a relocatable object.

Restrictions

This option:

  • Requires that the object or image file has debug information.
  • Can be used in text mode and with --expandarrays.

Examples

The following examples show how to use --fieldoffsets:

  • To produce an output listing to stdout that contains all the field offsets from all structures in the file inputfile.o, enter:

    fromelf --fieldoffsets inputfile.o
  • To produce an output file listing to outputfile.s that contains all the field offsets from structures in the file inputfile.o that have a name starting with p, enter:

    fromelf --fieldoffsets --select=p* --output=outputfile.s inputfile.o
  • To produce an output listing to outputfile.s that contains all the field offsets from structures in the file inputfile.o with names of tools or moretools, enter:

    fromelf --fieldoffsets --select=tools.*,moretools.* --output=outputfile.s inputfile.o
  • To produce an output file listing to outputfile.s that contains all the field offsets of structure fields whose name starts with number and are within structure field top in structure tools in the file inputfile.o, enter:

    fromelf --fieldoffsets --select=tools.top.number* --output=outputfile.s inputfile.o

The following is an example of the output, and includes name. and name...member that arise because of anonymous structs and unions:

; Structure, Table , Size 0x104 bytes, from inputfile.cpp
|Table.TableSize|                        EQU    0        ;  int
|Table.Data|                             EQU    0x4      ;  array[64] of MyClassHandle
; End of Structure Table
; Structure, Box2 , Size 0x8 bytes, from inputfile.cpp
|Box2.|                                  EQU    0        ;  anonymous
|Box2..|                                 EQU    0        ;  anonymous
|Box2...Min|                             EQU    0        ;  Point2
|Box2...Min.x|                           EQU    0        ;  short
|Box2...Min.y|                           EQU    0x2      ;  short
|Box2...Max|                             EQU    0x4      ;  Point2
|Box2...Max.x|                           EQU    0x4      ;  short
|Box2...Max.y|                           EQU    0x6      ;  short
; Warning: duplicate name (Box2..) present in (inputfile.cpp) and in (inputfile.cpp)
; please use the --qualify option
|Box2..|                                 EQU    0        ;  anonymous
|Box2...Left|                            EQU    0        ;  unsigned short
|Box2...Top|                             EQU    0x2      ;  unsigned short
|Box2...Right|                           EQU    0x4      ;  unsigned short
|Box2...Bottom|                          EQU    0x6      ;  unsigned short
; End of Structure Box2
; Structure, MyClassHandle , Size 0x4 bytes, from inputfile.cpp
|MyClassHandle.Handle|                   EQU    0        ;  pointer to MyClass
; End of Structure MyClassHandle
; Structure, Point2 , Size 0x4 bytes, from defects.cpp
|Point2.x|                               EQU    0        ;  short
|Point2.y|                               EQU    0x2      ;  short
; End of Structure Point2
; Structure, __fpos_t_struct , Size 0x10 bytes, from C:\Program Files\DS-5\bin\..\include\stdio.h
|__fpos_t_struct.__pos|                  EQU    0        ;  unsigned long long
|__fpos_t_struct.__mbstate|              EQU    0x8      ;  anonymous
|__fpos_t_struct.__mbstate.__state1|     EQU    0x8      ;  unsigned int
|__fpos_t_struct.__mbstate.__state2|     EQU    0xc      ;  unsigned int
; End of Structure __fpos_t_struct
    END
Non-ConfidentialPDF file icon PDF versionARM DUI0477M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.