Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I show the contents of a TStringList in the debugger?

I want to display the entire content of a TStringList while debugging the application. Instead I just get pointers. The Flist is showing only the address.

like image 960
Kumar S Avatar asked Aug 15 '11 16:08

Kumar S


3 Answers

If you are using Delphi 2010 or later, the debugger allows for this using debug visualizers.

For older versions, you can dump the contents of the Text property in the Watch window or using OutputDebugString, but that's difficult to read. You could set up watches for each element of the list, but that's only practical for very short lists.

I would probably use an external logging app like CodeSite or SmartInspect that let you dump the contents of a TStringList in a single call.

like image 126
Bruce McGee Avatar answered Sep 23 '22 06:09

Bruce McGee


Inspect the Text property. It's the concatenated version of the stringlist.

like image 30
Kluge Avatar answered Sep 23 '22 06:09

Kluge


Since i´m using BDS MMVI, i´m using an "ultra clever smart" method for that kind issue, i use it for large xml documents. I start context file editor (very capable free text editor writen in delphi by the way). On the debugger window a just do a FList.SaveToFile('contents.txt'), since context can monitor file modifications i can see whats happening in my xml files.

Sorry for the "clever" joke but it does work for me.

Peace

like image 28
José Eduardo Avatar answered Sep 23 '22 06:09

José Eduardo