using dwarf2
  var s: string[5]
will generate info as shown at the end of this mail

The array "st" is at
  DW_AT_data_member_location: 2 byte block: 23 1 (DW_OP_plus_uconst: 1)
That means, the array does not contain the length.

Yet the bounds of the array are 0 to 5.
That is one to much. It also leads to gdb showing the wrong char for "s[1]". Should show first, but does show 2nd

While on the subject. Is there any better way to encode ansistrings? (currently simply as pointer to char). I hoped it was only gdb shortcoming that they are indistinguishable from pchar (0 based idx vs 1 based). But actually fpc, encodes them as the same thing. (even dwarf2 has DW_TAG_string_type / I dont know about gdb...) DW_TAG_string_type allows even for a length. It does not have a start index...


 <2><1b5>: Abbrev Number: 6 (DW_TAG_structure_type)
    <1b6>   DW_AT_name        : ShortString
    <1c2>   DW_AT_byte_size   : 6
 <3><1c3>: Abbrev Number: 7 (DW_TAG_member)
    <1c4>   DW_AT_name        : length
<1cb> DW_AT_data_member_location: 2 byte block: 23 0 (DW_OP_plus_uconst: 0)
    <1ce>   DW_AT_type        : <0x230>
 <3><1d2>: Abbrev Number: 7 (DW_TAG_member)
    <1d3>   DW_AT_name        : st
<1d6> DW_AT_data_member_location: 2 byte block: 23 1 (DW_OP_plus_uconst: 1)
    <1d9>   DW_AT_type        : <0x1de>
 <2><1de>: Abbrev Number: 8 (DW_TAG_array_type)
    <1df>   DW_AT_byte_size   : 6
    <1e0>   DW_AT_stride      : 1
    <1e1>   DW_AT_type        : <0x2a0>
 <3><1e5>: Abbrev Number: 9 (DW_TAG_subrange_type)
    <1e6>   DW_AT_lower_bound : 0
    <1e7>   DW_AT_upper_bound : 5
    <1e8>   DW_AT_type        : <0x230>
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to