April 02, 2007
What is the DWARF type of char[], as output by the DMD backend?

I have compiled this sample:

import std.stdio;

int main()
{
    char[] greet = "Hello";

    writefln(greet);
    return 0;
}

Then ran readelf -w hello

As shown in this snippet, the type of greet is unsigned long long (entry at offset <c2>):

<1><c2>: Abbrev Number: 2 (DW_TAG_base_type)
     DW_AT_name        : unsigned long long
     DW_AT_byte_size   : 8
     DW_AT_encoding    : 7  (unsigned)
 <1><d8>: Abbrev Number: 4 (DW_TAG_subprogram)
     DW_AT_sibling     : <104>
     DW_AT_name        : _Dmain
     DW_AT_decl_file   : 1
     DW_AT_decl_line   : 3
     DW_AT_type        : <bb>
     DW_AT_low_pc      : 0x804a358
     DW_AT_high_pc     : 0x804a383
     DW_AT_frame_base  : 1 byte block: 55   (DW_OP_reg5)
 <2><f5>: Abbrev Number: 3 (DW_TAG_variable)
     DW_AT_name        : greet
     DW_AT_type        : <c2>
     DW_AT_location    : 2 byte block: 91 78    (DW_OP_fbreg: -8)



Top | Discussion index | About this forum | D home