string => always 1 based, always been
pchar => pointer-to-array-of-char => 0 based, arrays are 0 based by default
GDB:
@anna: you are right in gdb a[0] fo9r string works
but it's a bug.
GDB is a debugger originally written for C, not pascal. GDB has some ability to deal with any language, including pascal.
Unfortunately at current it's not possible to tell gdb that pascal strings are 1 based. Or maybe it is possible (dwarf 3), but not yet implemented.
So in gdb all string indices are wrong by 1.
And yes, it makes debugging strings very inconvenient. But there is no quick fix:
- dwarf3 is under development, it will one day be supported by fpc. and probably gdb supports it too. But it doesn;t look like anytime soon
- The alternative is to write an entire debugger from scratch. There are some projects, but again not even close to anytime soon.