[Dwarf-discuss] Question: Clarification for DW_AT_string_length
Martin
lists@mfriebe.de
Wed May 22 12:08:08 GMT 2024
DW_AT_string_length is described as "that provides the value of the
length of the string"
Is that the length in characters or bytes?
That matters for e.g. Utf-16 when the DW_TAG_base_type for the char has
a DW_AT_byte_size of 2 (or more).
Below is from the draft for DWARF-6, but the same info is in earlier
versions.
> 5.11 String Type Entries
> The string type entry may also have a DW_AT_string_length attribute whose
> value is either (a) a reference (see Section 2.19) to another debugging information
> entry that provides the value of the length of the string, or (b) a location
> description yielding the location where the length of the string is stored in the
> program. If the DW_AT_string_length attribute is not present, the size of the
> string is assumed to be the amount of storage that is allocated for the string (as
> specified by the DW_AT_byte_size or DW_AT_bit_size attribute)
More information about the Dwarf-discuss
mailing list