0

我有一个奇怪的行为:

我加载了一个包含两个全局变量的 ELF 文件:E1 和 S1

这两个变量都声明为“int”,但 TRACE32 将 E1 视为 FLOAT,将 S1 视为 int。

我尝试使用“readelf”,但它只说 E1 和 S1 是 OBJECT。

T32 如何找到这些信息?

4

1 回答 1

1

我尝试使用“readelf”,但它只说 E1 和 S1 是 OBJECT。

可能是这样做的:(readelf -s elf-file一般来说,在提问时,最好准确地说出你做了什么)。

试试readelf -wi elf-file吧。您可能会看到如下内容:

<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

注意E1DW_AT_type( ),而有类型0x57( ) 。intS10xd7float

于 2015-03-02T01:47:22.113 回答