I found some difficulties debugging, and did some tests, specifically trying to find what is in string lists.
I used a short project to test in Typhon32 v6.7 stable, on windows 10 64 bits with latest updates; just a window with one button and two edits, with the following code:
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
public
end;
var
Form1: TForm1;
list1: TStringList;
combo1: TComboBox;
implementation
{$R *.frm}
{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
begin
list1 := TStringList.Create;
list1.Add('Uno');
list1.Add('Dos');
list1.Add('Tres');
combo1 := TComboBox.Create(nil);
combo1.Items.Add('One');
combo1.Items.Add('Two');
combo1.Items.Add('Three');
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:= list1.Text;
Edit2.Text:= combo1.Items.Text;
end;
end.
I set a breakpoint in the first line of the click event handler and try to inspect list1 and combo1.items. tested with different debugger configurations; these are my results:
- With the default gdb, pressing Ctrl-F7 with the cursor on list1 gives a long listing of properties:
<TSTRINGLIST> = {
<TSTRINGS> = {
<TPERSISTENT> = {
<TOBJECT> = {
_vptr$TOBJECT = $58a7f4},
FOBSERVERS = $0},
FDEFAULTENCODING = $2708500,
FENCODING = $0,
FSPECIALCHARSINITED = false,
FALWAYSQUOTE = false,
FQUOTECHAR = 0 #0,
FDELIMITER = 0 #0,
FNAMEVALUESEPARATOR = 0 #0,
FUPDATECOUNT = 0,
FADAPTER = $0,
FLBS = TLBSLF,
FSKIPLASTLINEBREAK = false,
FSTRICTDELIMITER = false,
FLINEBREAK = $0,
FWRITEBOM = true,
UPDATECOUNT = 0,
DEFAULTENCODING = $2708500,
ENCODING = $0,
STRICTDELIMITER = false,
ALWAYSQUOTE = false,
STRINGSADAPTER = $0,
WRITEBOM = true},
FLIST = $26f8390,
FCOUNT = 3,
FCAPACITY = 4,
FONCHANGE = {
Proc = {
procedure (POINTER,
TOBJECT)} 0x27180f0,
Self = $0},
FONCHANGING = {
Proc = {
procedure (POINTER,
TOBJECT)} 0x27180f0,
Self = $0},
FDUPLICATES = DUPIGNORE,
FCASESENSITIVE = false,
FFORCESORT = false,
FOWNSOBJECTS = false,
FSORTSTYLE = SSLNONE,
DUPLICATES = DUPIGNORE,
CASESENSITIVE = false,
ONCHANGE = {
Proc = {
procedure (POINTER,
TOBJECT)} 0x27180f0,
Self = $0},
ONCHANGING = {
Proc = {
procedure (POINTER,
TOBJECT)} 0x27180f0,
Self = $0},
OWNSOBJECTS = false,
SORTSTYLE = SSLNONE}
Typing list1[0] in the evaluate window gives the same result (or almost the same, I didn't inspect in detail). For reference, in delphi typing this results in "Uno" the first string in the list as expected.
Evaluating combo1.items gives a result similar to list1; however evaluating combo1.items[0] results in:
<TSTRINGS> = {
<TPERSISTENT> = {
<TOBJECT> = {
_vptr$TOBJECT = $58a7f4},
FOBSERVERS = $0},
FDEFAULTENCODING = $2708500,
FENCODING = $0,
FSPECIALCHARSINITED = false,
FALWAYSQUOTE = false,
FQUOTECHAR = 0 #0,
FDELIMITER = 0 #0,
FNAMEVALUESEPARATOR = 0 #0,
FUPDATECOUNT = 0,
FADAPTER = $0,
FLBS = TLBSLF,
FSKIPLASTLINEBREAK = false,
FSTRICTDELIMITER = false,
FLINEBREAK = $0,
FWRITEBOM = true,
UPDATECOUNT = 0,
DEFAULTENCODING = $2708500,
ENCODING = $0,
STRICTDELIMITER = false,
ALWAYSQUOTE = false,
STRINGSADAPTER = $0,
WRITEBOM = true}
But the actual string is not shown either.
Finally, pressing F8 and trying to inspect Edit1.Text results in:
Type TEDIT has no component named TEXT.
However, inspecting Edit1.FCaption results in
TTranslatestring($02789C6C) 'Edit1'
The text seems not updated yet (running the program sets Edit1 and 2 to the full string lists).
- Selecting GDB with fpdebug as debugger, doing as above and inspecting list1, I get a shorter (but better looking) result:
TStringListTStringList (FLIST = $02678390;
FCOUNT = 3;
FCAPACITY = 4;
FONCHANGE = TNOTIFYEVENT($00000000);
FONCHANGING = TNOTIFYEVENT($00000000);
FDUPLICATES = DUPIGNORE;
FCASESENSITIVE = False;
FFORCESORT = False;
FOWNSOBJECTS = False;
FSORTSTYLE = SSLNONE;
DUPLICATES = DUPIGNORE;
CASESENSITIVE = False;
ONCHANGE = TNOTIFYEVENT($00000000);
ONCHANGING = TNOTIFYEVENT($00000000);
OWNSOBJECTS = False;
SORTSTYLE = SSLNONE;
FDEFAULTENCODING = TENCODING($02688500);
FENCODING = nil;
FSPECIALCHARSINITED = False;
FALWAYSQUOTE = False;
FQUOTECHAR = #$00;
FDELIMITER = #$00;
FNAMEVALUESEPARATOR = #$00;
FUPDATECOUNT = 0;
FADAPTER = nil;
FLBS = TLBSLF;
FSKIPLASTLINEBREAK = False;
FSTRICTDELIMITER = False;
FLINEBREAK = nil;
FWRITEBOM = True;
UPDATECOUNT = 0;
DEFAULTENCODING = TENCODING($02688500);
ENCODING = nil;
STRICTDELIMITER = False;
ALWAYSQUOTE = False;
STRINGSADAPTER = nil;
WRITEBOM = True;
FOBSERVERS = nil;
_vptr$TOBJECT = $0058A7F4)
However, asking for list1[0] results in:
Not a type or Array. Cannot access indexed element on expression [
Evaluating combo1.items and combo1.Items[0] I get the same results.
Pressing F8 and evaluating Edit1.Text results in
but evaluating Edit1.FCaption I get as before
TTRANSLATESTRING($02689C6C) 'Edit1'
- Selecting FpDebug internal Dwarf-debugger and choosing the standard Dwarf option gives the following:
Inspecting list1:
TStringList (FLIST = $025A82C8;
FCOUNT = 3;
FCAPACITY = 4;
FONCHANGE = TNOTIFYEVENT($00000000);
FONCHANGING = TNOTIFYEVENT($00000000);
FDUPLICATES = DUPIGNORE;
FCASESENSITIVE = False;
FFORCESORT = False;
FOWNSOBJECTS = False;
FSORTSTYLE = SSLNONE;
DUPLICATES = DUPIGNORE;
CASESENSITIVE = False;
ONCHANGE = TNOTIFYEVENT($00000000);
ONCHANGING = TNOTIFYEVENT($00000000);
OWNSOBJECTS = False;
SORTSTYLE = SSLNONE;
FDEFAULTENCODING = TENCODING($025B8438);
FENCODING = nil;
FSPECIALCHARSINITED = False;
FALWAYSQUOTE = False;
FQUOTECHAR = #$00;
FDELIMITER = #$00;
FNAMEVALUESEPARATOR = #$00;
FUPDATECOUNT = 0;
FADAPTER = nil;
FLBS = TLBSLF;
FSKIPLASTLINEBREAK = False;
FSTRICTDELIMITER = False;
FLINEBREAK = nil;
FWRITEBOM = True;
UPDATECOUNT = 0;
DEFAULTENCODING = TENCODING($025B8438);
ENCODING = nil;
STRICTDELIMITER = False;
ALWAYSQUOTE = False;
STRINGSADAPTER = nil;
WRITEBOM = True;
FOBSERVERS = nil;
_vptr$TOBJECT = $0058A7F4)
and list1[0]:
Not a type or Array. Cannot access indexed element on expression [
as before.
Pressing F8 the program does not stop at the next statement, seems to stop before quitting. Moreover, if I press the red stop button the assembly window is opened, the program quits (its icon in the taskbar disapperars) but the red button continues to be enabled whereas the execute buttons remain disabled, and the IDE gets stuck: if one tries to quit the IDE it asks to stop debugging but does nothing. The only way is to kill the IDE AND restart windows, otherwise the debugger (any) gets stuck equally
- Finally, with lldb (when it does not crash; ok, I undertand that this is alpha):
Ctrl-F7 on list1, I only get the FLIST property:
(TSTRINGLIST) $2 = 0x02688040
Suprisingly, trying to view list1[0] gives the full (or almost) property listing:
(TSTRINGLIST) $3 = { (TSTRINGS) TSTRINGS = { (TPERSISTENT) TPERSISTENT = { (TFPLIST) FOBSERVERS = 0x00000000 } (TENCODING) FDEFAULTENCODING = 0x02678450 (TENCODING) DEFAULTENCODING = 0x02678450 (TENCODING) FENCODING = 0x00000000 (TENCODING) ENCODING = 0x00000000 (BOOLEAN) FSPECIALCHARSINITED = false (BOOLEAN) FALWAYSQUOTE = false (BOOLEAN) ALWAYSQUOTE = false (CHAR) FQUOTECHAR = '\0' (CHAR) FDELIMITER = '\0' (CHAR) FNAMEVALUESEPARATOR = '\0' (LONGINT) UPDATECOUNT = 0 (LONGINT) FUPDATECOUNT = 0 (ISTRINGSADAPTER) STRINGSADAPTER = 0x00000000 (ISTRINGSADAPTER) FADAPTER = 0x00000000 (TTEXTLINEBREAKSTYLE) FLBS = TLBSLF (BOOLEAN) FSKIPLASTLINEBREAK = false (BOOLEAN) STRICTDELIMITER = false (BOOLEAN) FSTRICTDELIMITER = false (ANSISTRING) FLINEBREAK = 0x00000000 <no value available> (BOOLEAN) WRITEBOM = true (BOOLEAN) FWRITEBOM = true } (PSTRINGITEMLIST) FLIST = 0x026682e0 (LONGINT) FCOUNT = 3 (LONGINT) FCAPACITY = 4 (TNOTIFYEVENT) FONCHANGE = { (TOBJECT) Self = 0x00000000 } (TNOTIFYEVENT) FONCHANGING = { (TOBJECT) Self = 0x00000000 } (TDUPLICATES) FDUPLICATES = DUPIGNORE (BOOLEAN) FCASESENSITIVE = false (BOOLEAN) FFORCESORT = false (BOOLEAN) FOWNSOBJECTS = false (TSTRINGSSORTSTYLE) FSORTSTYLE = SSLNONE (TDUPLICATES) DUPLICATES = DUPIGNORE (BOOLEAN) CASESENSITIVE = false (TNOTIFYEVENT) ONCHANGE = { (TOBJECT) Self = 0x00000000 } (TNOTIFYEVENT) ONCHANGING = { (TOBJECT) Self = 0x00000000 } (BOOLEAN) OWNSOBJECTS = false (TSTRINGSSORTSTYLE) SORTSTYLE = SSLNONE}
The same happens with combo1.items.
Pressing F8 at this points opens the Assembly window with all 0s.
In summary, I cannot find a way to see what is inside a stringlist (other than directly searching memory). It would be desirable to be able: I know that debugging is a difficult point, but somewhere in the future that should be posible.
Regards