Program freezes but the CPU utilization is zero

2019-02-16 06:11发布

问题:

Sometimes my program freezes. If i click 'Pause program' it shows me this:

ntdll.RtlUserThreadStart:
773301C4 89442404         mov [esp+$04],eax
773301C8 895C2408         mov [esp+$08],ebx
773301CC E9E9960200       jmp $773598ba
773301D1 8DA42400000000   lea esp,[esp+$0000]
773301D8 8DA42400000000   lea esp,[esp+$0000]
773301DF 90               nop 

'Call Stack' window IS EMPTY!

Pressing F8 three times, the program jumps to

ntdll.RtlInitializeExceptionChain:
7735989F 8BFF             mov edi,edi

I cannot reproduce it on demand but I see the problem once per day (maybe less?).
The compiler/debugger is running in 32 bit.

Any idea if this is a debugger problem? I encountered something similar in the past: sometimes when you run an external application from your Delphi app, the debugger freezes. This is a documented bug for Delphi XE7. So, I am thinking, maybe this is a similar/related bug?


回答1:

I am making progress here! I have found a similar issue in a program of mine. The freeze appears when I try to load a large text (over 100000) in a custom list box because of this code:

MyListBox.Items.Text:= xxx;


procedure TMyListBox.LBADDSTRING(var M: TMessage);   { This makes the control slow when I work with 100000 lines }
begin
 inherited;
 if Assigned(FOnChange)
 then FOnChange(Self, lbAdded);
end;

The execution point runs through LBADDSTRING for every line (100000 times). So, it seems frozen.

Odd is also the fact, that if I pause the program, Delphi cannot accurately show the execution point for my program (I checked all 5 threads). So, all this is in the end a Delphi debugger flaw.