sizeof

Lcrash HOWTO
Prev | Chapter 4. Lcrash Command Reference | Next

# 4.22. sizeof

#### Alias

offset

#### Usage

    sizeof
            type | structure.field [...]
            -o structure.field [...]
            [-w outfile]

#### Description

    Display size of data types in bytes. Additionally display offsets for
    members of structs.

    OPTIONS:
     type | structure.field [...]
           Print size of types (basic types, structs, typedefs) or
           member of structures in bytes.
     -o structure.field [...]
           Determine the member offset. Only arguments of the form
           'structure.field' are allowed.

    To request size for multi-worded types (e.g. "short int") specify the
    type whithin "".

    Note: An alias "offset" exists for the calling sequence "sizeof -o".

Example 4-13. sizeof

    >> sizeof task_struct module_ref int double
    Size of "task_struct": 1152 bytes
    Size of "module_ref": 12 bytes
    Size of "int": 4 bytes
    Size of "double": 8 bytes

    >> sizeof mem_map_t page pgd_t
    Size of "mem_map_t": 40 bytes
    Size of "page": 40 bytes
    Size of "pgd_t": 4 bytes

    >> sizeof page.next mem_map_t.index thread_struct.trace -o
    Offset: 0 bytes.
    Offset: 8 bytes.
    Offset: 100 bytes.

    >> sizeof "long long unsigned int" "short int" "long double"
    Size of "long long unsigned int": 8 bytes
    Size of "short int": 2 bytes
    Size of "long double": 12 bytes

    >> sizeof "short unsigned int" mm_struct.count task_struct -o
    ERROR: Could not determine offset for short unsigned int.
    Offset: 16 bytes.
    ERROR: Could not determine offset for task_struct.

Prev | Home | Next
s390dbf | Up | stat