It would be one of the very important features to implement
Indeed. And it is in progress. Joost is working on it. However, it actually requires changes to the compiler itself. So the earliest this might become available would be when FPC 3.4.0 will be out (the next FPC, afaik will be 3.2.4).
Some background info:
Currently the compiler does not tell the debugger how to look into a TStringList. And the debugger (any debugger) is limited to whatever info it gets from the compiler. It's called debug-info (..g., "DWARF"). Once available, it will tell the debugger, where the compiler put the data of the string-list.
Until such time, you can use one of the following watches (the 2nd, if you have "L: TStrings" and need to typecast it):
- assuming "var L: TStringList;"
- you use FpDebug / LazDebuggerFp
- Your RTL is build with debug-info / and RTL debug-info is set to "DWARF" (any of the dwarf settings / for FpDebug your can go with DWARF-3)
(TStringList(L).FList)^[0]
You can use the "Debug-inspector" (menu: Run > Inspect).
There you can inspect the variable "L", and double-click the "FList" field, then again double click the entry "L.FList" to deref the pointer.
After that you need to edit the expression yourself, and add the "[0]" (or whatever index you want).
Once you got the entry, you can press the "Add watch" button. (you can then edit the index, and add more watches)
Or you can add the following watch (may depend on your fpc version)
And set a "repeat count" in the watch properties. (Without repeat count you may get a hell of a lot of entries / more than the list actually has).
If your RTL does not have debug info you can try^AnsiString(L.FList)[i*2]
where i is the index.
So if you want the string at index 5 then your watch must be "^AnsiString(L.FList)[10]".
The odd indexes are the objects stored in the TStringList. However the above type-casts anything to an AnsiString - not really meaningful for a TObject....
And: No, there is on way to get the full "StringList.Text".
Not until the new feature is ready.
About: "you use FpDebug / LazDebuggerFp"
- If you use the old "gdb based" debugger, this workaround may crash the debugger.
- The last example with the "AnsiString" type-cast may work with the "gdb based" debugger. Though intstead of "AnsiString" you may need to give "PChar" or "^Char" (note, the latter ends up as "^^Char(..)[..]")
- LazDebuggerFp is the default in Lazarus version 2.2. But if you upgraded from an older version (even if you uninstalled, since your old config is kept even then) then the setting for "gdb based" will still be active. See menu: Tools > Options > Debugger > Backend
- LazDebuggerFp is also available in Lazarus version 2.0.x. But you may need to install the package "LazDebuggerFp" first.
About "
RTL is build with debug-info "
=> Actually, that is probably
not required. => The compiler will generate the missing debug info for any class that you use. According to my tests, at least on Windows this works.
About: "menu: Run > Inspect"
=> Maybe in future that will move to "menu: View > Debug windows > Inspector" ... Maybe...