How do I debug my program when it freezes?

I have an application that measures every second (I run it in demo mode and generate arbitrary data, so the problem is not related to reading from devices connected to the serial port).

After 5-6 minutes it hangs.

I added

try
  // entire body of procedure/function goes here

except
     on E: Exception do
        begin
           MessageDlg('Internal coding error in <function name>()', 
                          mtError, [mbOK], 0);
        end;
end;

for each individual function (and Application.Run () in the project file), but I do not see any message dialogs. Any idea how I can verify this?


Update: I believe that the problem with the resource is either random access memory or the MySql database , but they work fine, and there are only 5 floats and timestamps that are saved during each measurement, so both seem unlikely after such a short time.


: ( +1 ), , , ( ), IDE Run/Pause, , .

.

+3
5

:

  • "" , , , ( ).

  • (, ), / . , .

  • (, ..) PerfMon - . , .

  • , , - . , - .

  • .NET , , (, catch) IDE . Delphi, , , .

+5

, , , .

. , . , "Debug: Break All" ( ), .

Threads . , . , , - . , , , , - .

, - , - A A, B, B B A. , , .

, , , . , .

, , .

+5

, MessageDlgs .

( ), - , . ( OutputDebugStr), - , . . , OutputDebugStr, , , , .

+1

Delphi. -: ( ), " " ( ): http://code.google.com/p/asmprofiler/wiki/ProcessStackViewer
( : .map .jdbg) (, / ). ( ).

+1

If you need help with these kinds of things in an application for which you cannot use the IDE, then something like madExcept can help a lot. It has an automatic freeze check for the main thread, and you can have it by giving a stack dump to show what it was doing when it was frozen. The user can choose to kill or continue, and the application can tell madExcept, because it is busy and does not warn if it is necessary (for long-term analysis or printing or something else).

0
source

Source: https://habr.com/ru/post/1783329/


All Articles