Fabrice LARRIBE
Fabrice LARRIBE

Reputation: 332

How does TRACE32 know the type of a global symbol loaded from an ELF?

I have a strange behaviour:

I load an ELF file containing two global variables : E1 and S1

Those two variable are both declared as "int" but TRACE32 see E1 as a FLOAT and S1 as an int.

I try to use "readelf" but it only say that E1 and S1 are OBJECT.

How does T32 find this information ?

Upvotes: 0

Views: 328

Answers (1)

Employed Russian
Employed Russian

Reputation: 213897

I try to use "readelf" but it only say that E1 and S1 are OBJECT.

You probably did this: readelf -s elf-file (in general, when asking questions, it's better to say exactly what you did).

Try readelf -wi elf-file instead. You will probably see something like:

<1><57>: Abbrev Number: 3 (DW_TAG_base_type)
    <58>   DW_AT_byte_size   : 4
    <59>   DW_AT_encoding    : 5        (signed)
    <5a>   DW_AT_name        : int
...
<1><af>: Abbrev Number: 6 (DW_TAG_variable)
    <b0>   DW_AT_name        : E1
    <b3>   DW_AT_decl_file   : 1
    <b4>   DW_AT_decl_line   : 4
    <b5>   DW_AT_type        : <0x57>
    <b9>   DW_AT_external    : 1
    <b9>   DW_AT_location    : 9 byte block: 3 50 10 60 0 0 0 0 0       (DW_OP_addr: 601050)
 <1><c3>: Abbrev Number: 6 (DW_TAG_variable)
    <c4>   DW_AT_name        : S1
    <c7>   DW_AT_decl_file   : 1
    <c8>   DW_AT_decl_line   : 5
    <c9>   DW_AT_type        : <0xd7>
    <cd>   DW_AT_external    : 1
    <cd>   DW_AT_location    : 9 byte block: 3 4c 10 60 0 0 0 0 0       (DW_OP_addr: 60104c)
 <1><d7>: Abbrev Number: 2 (DW_TAG_base_type)
    <d8>   DW_AT_byte_size   : 4
    <d9>   DW_AT_encoding    : 4        (float)
    <da>   DW_AT_name        : (indirect string, offset: 0x9d): float

Note how E1 has DW_AT_type of 0x57 (int), while S1 has type 0xd7 (float).

Upvotes: 1

Related Questions