Delphi 10.2 latest build 2004, win x64 VCL app.
Trying to debug my large multithread appication I faced lots of $C00000005 exceptions in strange places. Attepmpts to narrow the problem have lead me to this minimal example: create some (10 in my case are enough to see the issue) threads, compile with "use debug .dcus".
Set breakpoint at second sleep
and hit F9 several times, until exception is raised.
When its raised, assembly code looks broken (look screenshot).
The RIP
points to the middle of the correct instruction.
When I compile the same test app for Win32, it just hangs in debugger after several F9s, so I can not even make errors screenshots.
Update:
More about the original issue caused me to start looking for debugger issue: My life app (VCL win x64) sometimes stops working with the error "a problem caused the program to stop working correctly".
Every thread has exception logging system, so since the log is empty after such fail, I was hope that beeing run in debugger it will give me some useful info.
Without breakpoints the life app sometimes (very rare, about once in 5 hours) throws an exception leads deep into system.pas (look last screen). On this screen the last System._USstrClr had nil pointer.
Excactly the same picture I have when I put breakpoint at System._USstrClr and hit F9 several times, it ends up with nil pointers.
I dont state that these 2 issues have the same reason, just trying to understand what's going on.
From what I saw this happens only in debugger.
The life app compiled with Release build does not throw exeptions, it just stops with "a problem caused the program to stop working correctly" as my users report (and with empty logs with no info about any errors).
TMyThread = class (TThread)
procedure Execute; override;
end;
var
frmClientTest: TfrmClientTest;
ThreadList: TList<TMyThread>;
procedure TfrmClientTest.FormCreate(Sender: TObject);
var
k: integer;
begin
ThreadList:=TList<TMyThread>.Create;
for k:=0 to 10 do ThreadList.Add(TMyThread.Create);
end;
procedure TMyThread.Execute;
begin
FreeOnTerminate:=false;
repeat
sleep(100);
sleep(200);
until Terminated;
end;
=================
The real app exception: