[Dwarf-discuss] Idea/Question: Add DW_AT_LowerBound to DW_TAG_String

Todd Allen Todd.Allen@concurrent-rt.com
Mon Apr 20 17:53:58 GMT 2026


Martin,

The default lower bound is just a default.  An array always can just specify the DW_AT_lower_bound if it differs from the language-defined default.  In Ada, for example, lower bounds always are explicit.  The choice of 1 as its default was a guess about what coders would be most likely to use.  (And probably Ada's similarities to Pascal was a factor.)

Todd

On 4/19/26 14:03, Martin via Dwarf-discuss wrote:
A string is a sequence of chars...
And usually a string allows access to those chars by index.

This index can be 0 or 1 based. If a debugger is asked to evaluate
"MyString[1]" this could be the first or 2nd char.

It is possible to have defaults per language for this.
But that is not always enough.

In Pascal the index normally is 1 based.
But compilers like FPC and Delphi support a directive "{$ZEROBASEDSTRINGS}"
https://gitlab.com/freepascal.org/fpc/documentation/-/work_items/39484<https://gitlab.com/freepascal.org/fpc/documentation/-/work_items/39484>
which changes this to 0 based.

It might be desire-able to add this to DWARF.


Also Pascal strings (some of them) are ref-counted and have other fields
(like encoding).

Ref-count may be something generic (also applies to some arrays). And
may therefore deserve an attribute of its own?




--
Dwarf-discuss mailing list
Dwarf-discuss@lists.dwarfstd.org<mailto:Dwarf-discuss@lists.dwarfstd.org>
https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss<https://lists.dwarfstd.org/mailman/listinfo/dwarf-discuss>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dwarfstd.org/pipermail/dwarf-discuss/attachments/20260420/b4ed038c/attachment.htm>


More information about the Dwarf-discuss mailing list