Am 23.03.23 um 09:45 schrieb Martin Frb via fpc-devel:

It's a little hard to comment all at once, but at least I start with one :)

4) "official" marker for string vs pchar vs array

Not sure if that is reported already. Depending on dwarf version "string" (ansistring) is a pointer (either TAG pointer/reference or location expression) to
- char  (dwarf 2)
- array of char (dwarf 3)

Currently for dwarf 2, the debugger can't tell the difference. If the user says:  foo[1] The debugger does not know, if the first or second char is meant (0 or 1 based index)

With dwarf 3 the difference would be in the display format "('a', 'b', 'c') vs 'abc'. But currently the debugger (fpdebug) can tell the difference, because fpc has a tiny difference in how it encodes the "stride".
That is obviously an implementation detail, and not very future proof.

Therefore an "official" marker would be nice.
- it appears there is none in dwarf
- it could be a custom addition to dwarf
- documenting an "implementation detail" (such as the stride), so fpdebug can safely rely on it.

What about using DW_TAG_string_type for this? IIRC, when I implemented dwarf, it was not available/not supported, but fpdebug can do they. I am not sure about the status of GDB about it though :)

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to