Hi,
Recently I mentioned a issue with debugging (using GDB) and indexing in a AnsiString to retrieve a specific character from that string.
DWARF2
-----------
eg:
S := 'mystring';GDB can display the value of S without problems because it is treated as a PChar (from what I can see and understand).
c := s[1]GDB displays the wrong character from the string. GDB displays the 'y' character instead of the 'm' character. GDB or DWARF2 treats a AnsiString (or an array of char) being 0-indexing instead of 1-indexed.
DWARF3
-----------
c := s[1]GDB correctly displays the first character of the string stored in s. This is accomplished by using tho lower_bound = 1 attribute in DWARF3.
s := 'mystring'GDB cannot display the value of the ansistring stored in s, even thou DW_AT_type is set as well. It seems GDB cannot figure out how to handle displaying s, even though it knows it's an character array.
It seems the DWARF2/3 support with GDB is playing the vice-versa game. Fix one, break one.
This last part in DWARF3 above... it seems FPC has fulfilled the specs for DWARF3 (again from what I can understand from the DWARF3 spec inself) by correctly describing a AnsiString, so what is the issue now
- why can't GDB display the value (full string value) of a ansistring variable? Is it now the lack of Object Pascal support in GDB giving us the problems?
Sorry if this sounds dumb, but I'm new to DWARF and debuggers, so I just want to try and get my bearings with where exactly the problem sits. Is it with FPC, or with GDB, or both.
