Nach einigen Experimenten funktioniert folgender Code für mein Vorhaben zufriedenstellend
Wenn ich nur den Stack haben will mache ich folgendes:
Delphi-Quellcode:
...
// Form mit 1 x TButton + 1 x TMemo
implementation
uses
jclDebug;
{$R *.dfm}
function GetStackList(
IncludeModuleName: Boolean = False;
IncludeAddressOffset: Boolean = False;
IncludeStartProcLineOffset: Boolean = False;
IncludeVAddress: Boolean = False): string;
var
sl: TStringList;
begin
sl := TStringList.Create;
try
with TJclStackInfoList.Create(True, 0, nil) do
try
Delete(0); // TJclStackInfoList
Delete(0); // TJclStackInfoList
Delete(0); // GetStackList
AddToStrings(sl, IncludeModuleName, IncludeAddressOffset, IncludeStartProcLineOffset, IncludeVAddress);
finally
Free;
end;
Result := sl.Text;
finally
sl.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Memo1.Lines.Add(GetStackList);
end;
end.
Da kommt dann der Stack wie folgt raus:
Code:
[004DF643] Unit1.TForm1.Button1Click (Line 57, "Unit1.pas")
[00470E2B] Controls.TControl.Click (Line 7190, "Controls.pas")
[0049BD52] StdCtrls.TCustomButton.Click (Line 4562, "StdCtrls.pas")
[0049C840] StdCtrls.TCustomButton.CNCommand (Line 5023, "StdCtrls.pas")
[004708C0] Controls.TControl.WndProc (Line 7074, "Controls.pas")
[00475184] Controls.TWinControl.WndProc (Line 9831, "Controls.pas")
...