Einzelnen Beitrag anzeigen

Kas Ob.

Registriert seit: 3. Sep 2023
227 Beiträge
 
#28

AW: Delphi 12: Fehler mit Action := caFree

  Alt 5. Dez 2023, 17:43
To get a feeling for the message processing in the VCL you may want to read an old article on key processing I wrote an eon ago: A Key's Odyssey.
Thank you for the details, and definitely will read that article if that page decided to load on the browser.

Sorry again, we miss targeting the subject, as this wasn't my point, my point is the Call Stack reporting by debugger is either faulty or wrong, you assumed the the code before ProcessMessage is short and irrelevant, in my opinion that is false assumption based on simple fact or situation, as example, if the application called Application.ProcessMessages then ProcessMessage could be called again hence we end up with two on the stack, comes the debugger and cuts the for the latest one, and send us into goose chase.

We can't call Delphi debugger smart or AI powered to decide for us when and where to cut the stack list, as it is dumb as an ash tray.

I can list the main problems or shortcoming with debugger Call Stack :
1) it is wrong to cut or stop reporting on addresses as it wish (predefined on based on what ?), who decide this, and why it is not limited by a settings in case it will hinder the speed, (like it has space shuttle speed).
2) more than 2 decades with the same debugger that only resolve Delphi address symbols and yet there is no resolving for the OS libraries like User32 or the Kernel, the Debug Library Helper (DbgHelp.dll) is shipped with every Windows OS for eons and it does in fact resolve them, this also could be a setting to switch (so we can reach Mars a little sooner).
3) the debugger is skipping addresses on his own, again without justification, this will leads to hindering the debugging process itself, and wrongly reporting logic flow.

Here an example from EurekaLog Call Stack, it is nice and detailed
Code:
Call Stack Information:
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|Methods |Details|Stack  |Address |Module     |Offset |Source                               |Unit         |Class        |Procedure/Method                                 |Line                                             |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|*Exception Thread: ID=1332; Parent=0; Priority=0                                                                                                                                                                                   |
|Class=; Name=MAIN                                                                                                                                                                                                                 |
|DeadLock=0; Wait Chain=                                                                                                                                                                                                           |
|Comment=                                                                                                                                                                                                                          |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|7FFFFFFE|04     |00000000|00789469|Project5.exe|00389469|Unit10.pas                           |Unit10        |TForm10       |Button1Click                                     |28[1]                                            |
|00000060|04     |0019F3CC|00697D73|Project5.exe|00297D73|Vcl.Controls.pas                     |Vcl.Controls |TControl     |Click                                            |7361[9]                                          |
|00000020|04     |0019F3D8|006AEF2E|Project5.exe|002AEF2E|Vcl.StdCtrls.pas                     |Vcl.StdCtrls |TCustomButton |Click                                            |5327[3]                                          |
|00000020|04     |0019F3E0|006AFA3C|Project5.exe|002AFA3C|Vcl.StdCtrls.pas                     |Vcl.StdCtrls |TCustomButton |CNCommand                                        |5788[1]                                          |
|00000020|04     |0019F3E8|00697805|Project5.exe|00297805|Vcl.Controls.pas                     |Vcl.Controls |TControl     |WndProc                                          |7245[91]                                         |
|00000020|03     |0019F400|73789581|comctl32.dll|00049581|comctl32.dll                         |comctl32      |              | (possible InitCommonControlsEx+4449)            |                                                  |
|00000020|03     |0019F404|7451ED71|user32.dll |0001ED71|USER32.dll                           |USER32        |              |NotifyWinEvent                                   |                                                  |
|00000020|03     |0019F410|77172857|ntdll.dll  |00042857|ntdll.dll                            |ntdll        |              |RtlDeactivateActivationContextUnsafeFast         |                                                  |
|00000020|03     |0019F424|7716FA8B|ntdll.dll  |0003FA8B|ntdll.dll                            |ntdll        |              |RtlActivateActivationContextUnsafeFast           |                                                  |
|00000020|03     |0019F428|73789581|comctl32.dll|00049581|comctl32.dll                         |comctl32      |              | (possible InitCommonControlsEx+4449)            |                                                  |
|00000020|03     |0019F438|77172857|ntdll.dll  |00042857|ntdll.dll                            |ntdll        |              |RtlDeactivateActivationContextUnsafeFast         |                                                  |
|00000020|03     |0019F444|7453BF19|user32.dll |0003BF19|USER32.dll                           |USER32        |              | (possible AddClipboardFormatListener+1177)      |                                                  |
|00008020|03     |0019F494|74538436|a          |00038436|{38E0C963-48A9-4649-A681-F4F0B4371047}|recursive    |area         |removed                                          |4[0]                                             |
|00000020|03     |0019F498|745383E5|user32.dll |000383E5|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2421)                |                                                  |
|00000020|03     |0019F4A8|745386A6|user32.dll |000386A6|USER32.dll                           |USER32        |              | (possible DispatchMessageW+3126)                |                                                  |
|00000020|03     |0019F4AC|74538409|user32.dll |00038409|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2457)                |                                                  |
|00000020|03     |0019F4BC|74538436|user32.dll |00038436|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2502)                |                                                  |
|00000020|03     |0019F4F0|74538239|user32.dll |00038239|USER32.dll                           |USER32        |              | (possible DispatchMessageW+1993)                |                                                  |
|00000020|03     |0019F4F4|745386A6|user32.dll |000386A6|USER32.dll                           |USER32        |              | (possible DispatchMessageW+3126)                |                                                  |
|00000060|04     |0019F514|0069C3AD|Project5.exe|0029C3AD|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |WndProc                                          |10079[158]                                       |
|00000020|03     |0019F520|758F3411|kernel32.dll|00043411|KERNEL32.DLL                         |KERNEL32      |              | (possible GetAtomNameW+705)                     |                                                  |
|00000060|04     |0019F560|006AEBD8|Project5.exe|002AEBD8|Vcl.StdCtrls.pas                     |Vcl.StdCtrls |TButtonControl|WndProc                                          |5164[13]                                         |
|00000020|04     |0019F570|00697440|Project5.exe|00297440|Vcl.Controls.pas                     |Vcl.Controls |TControl     |Perform                                          |7023[10]                                         |
|00000060|04     |0019F58C|0069C513|Project5.exe|0029C513|Vcl.Controls.pas                     |Vcl.Controls |              |DoControlMsg                                     |10148[12]                                        |
|00000020|04     |0019F5A0|0069CF9B|Project5.exe|0029CF9B|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |WMCommand                                        |10423[1]                                         |
|00000020|04     |0019F5AC|00736C99|Project5.exe|00336C99|Vcl.Forms.pas                        |Vcl.Forms    |TCustomForm  |WMCommand                                        |6204[6]                                          |
|00000020|04     |0019F5B8|00697805|Project5.exe|00297805|Vcl.Controls.pas                     |Vcl.Controls |TControl     |WndProc                                          |7245[91]                                         |
|00000060|04     |0019F6E4|0069C3AD|Project5.exe|0029C3AD|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |WndProc                                          |10079[158]                                       |
|00000020|04     |0019F700|00409478|Project5.exe|00009478|System.pas                           |System       |TMonitor     |TryEnter                                         |17939[10]                                        |
|00000020|04     |0019F708|00409000|Project5.exe|00009000|System.pas                           |System       |TMonitor     |Enter                                            |17632[4]                                         |
|00000020|04     |0019F710|0069C3AD|Project5.exe|0029C3AD|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |WndProc                                          |10079[158]                                       |
|00000020|04     |0019F718|00408EA0|Project5.exe|00008EA0|System.pas                           |System       |TMonitor     |CheckOwningThread                                |17550[2]                                         |
|00000020|04     |0019F720|0040918E|Project5.exe|0000918E|System.pas                           |System       |TMonitor     |Exit                                             |17736[1]                                         |
|00000060|04     |0019F730|00733AEC|Project5.exe|00333AEC|Vcl.Forms.pas                        |Vcl.Forms    |TCustomForm  |WndProc                                          |4427[206]                                        |
|00000020|04     |0019F744|0069B9CC|Project5.exe|0029B9CC|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9786[3]                                          |
|00000020|04     |0019F74C|0069B9E1|Project5.exe|0029B9E1|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9789[6]                                          |
|00000060|04     |0019F75C|0069B9CC|Project5.exe|0029B9CC|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9786[3]                                          |
|00000020|04     |0019F770|0069B9F6|Project5.exe|0029B9F6|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9789[6]                                          |
|00000060|04     |0019F78C|0051F93C|Project5.exe|0011F93C|System.Classes.pas                   |System.Classes|              |StdWndProc                                       |16882[8]                                         |
|00000060|03     |0019F7A4|7453BF19|user32.dll |0003BF19|USER32.dll                           |USER32        |              | (possible AddClipboardFormatListener+1177)      |                                                  |
|00000060|03     |0019F7D0|745383E5|user32.dll |000383E5|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2421)                |                                                  |
|00000020|03     |0019F804|74538436|user32.dll |00038436|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2502)                |                                                  |
|00000020|03     |0019F850|74538239|user32.dll |00038239|USER32.dll                           |USER32        |              | (possible DispatchMessageW+1993)                |                                                  |
|00000020|03     |0019F8A0|74537F85|user32.dll |00037F85|USER32.dll                           |USER32        |              | (possible DispatchMessageW+1301)                |                                                  |
|00000060|03     |0019F8B8|7451BEC5|user32.dll |0001BEC5|USER32.dll                           |USER32        |              | (possible SendMessageW+933)                     |                                                  |
|00000020|03     |0019F910|7453A6EB|user32.dll |0003A6EB|USER32.dll                           |USER32        |              | (possible SystemParametersInfoW+1211)           |                                                  |
|00000060|03     |0019F924|7451BC52|user32.dll |0001BC52|USER32.dll                           |USER32        |              |SendMessageW                                     |                                                  |
|00000060|03     |0019F99C|737897EC|comctl32.dll|000497EC|comctl32.dll                         |comctl32      |              | (possible InitCommonControlsEx+5068)            |                                                  |
|00000020|03     |0019F9CC|7716FA8B|ntdll.dll  |0003FA8B|ntdll.dll                            |ntdll        |              |RtlActivateActivationContextUnsafeFast           |                                                  |
|00000060|03     |0019F9EC|7453BF19|user32.dll |0003BF19|USER32.dll                           |USER32        |              | (possible AddClipboardFormatListener+1177)      |                                                  |
|00000060|03     |0019FA18|745383E5|user32.dll |000383E5|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2421)                |                                                  |
|00000020|03     |0019FA98|74538239|user32.dll |00038239|USER32.dll                           |USER32        |              | (possible DispatchMessageW+1993)                |                                                  |
|00000060|03     |0019FB00|74517AF8|user32.dll |00017AF8|USER32.dll                           |USER32        |              |CallWindowProcW                                  |                                                  |
|00000060|04     |0019FB3C|0069C4BE|Project5.exe|0029C4BE|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |DefaultHandler                                   |10120[30]                                        |
|00000020|04     |0019FB64|006981C8|Project5.exe|002981C8|Vcl.Controls.pas                     |Vcl.Controls |TControl     |WMLButtonUp                                      |7494[1]                                          |
|00000020|04     |0019FB90|00697805|Project5.exe|00297805|Vcl.Controls.pas                     |Vcl.Controls |TControl     |WndProc                                          |7245[91]                                         |
|00000020|03     |0019FBD8|771B03B7|ntdll.dll  |000803B7|ntdll.dll                            |ntdll        |              | (possible RtlCaptureStackContext+3687)          |                                                  |
|00000020|03     |0019FBF0|77201C64|ntdll.dll  |000D1C64|ntdll.dll                            |ntdll        |              | (possible RtlZeroHeap+1268)                     |                                                  |
|00000020|03     |0019FC4C|74377EF1|msctf.dll  |00057EF1|MSCTF.dll                            |MSCTF        |              | (possible CtfImeCreateInputContext+849)         |                                                  |
|00000020|03     |0019FC60|7437F19E|msctf.dll  |0005F19E|MSCTF.dll                            |MSCTF        |              | (possible TF_SetDefaultRemoteKeyboardLayout+9086)|                                                  |
|00000020|03     |0019FC78|771B03B7|ntdll.dll  |000803B7|ntdll.dll                            |ntdll        |              | (possible RtlCaptureStackContext+3687)          |                                                  |
|00000020|03     |0019FC84|74852ADA|win32u.dll |00002ADA|win32u.dll                           |win32u       |              |NtUserGetThreadState                             |                                                  |
|00000020|03     |0019FC88|7452A170|user32.dll |0002A170|USER32.dll                           |USER32        |              |GetCapture                                       |                                                  |
|00000020|04     |0019FC90|0069BBBB|Project5.exe|0029BBBB|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |IsControlMouseMsg                                |9842[1]                                          |
|00000020|03     |0019FC94|74F5FB95|combase.dll |0010FB95|combase.dll                          |combase      |              | (possible CoGetApartmentType+309)               |                                                  |
|00000020|03     |0019FCA8|741304BF|oleaut32.dll|000204BF|OLEAUT32.dll                         |OLEAUT32      |              | (possible SysFreeString+239)                    |                                                  |
|00000060|04     |0019FCBC|0069C3AD|Project5.exe|0029C3AD|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |WndProc                                          |10079[158]                                       |
|00000020|03     |0019FCD0|74130418|oleaut32.dll|00020418|OLEAUT32.dll                         |OLEAUT32      |              |SysFreeString                                    |                                                  |
|00000020|03     |0019FCEC|74377EF1|msctf.dll  |00057EF1|MSCTF.dll                            |MSCTF        |              | (possible CtfImeCreateInputContext+849)         |                                                  |
|00000020|03     |0019FCF4|74377EF9|msctf.dll  |00057EF9|MSCTF.dll                            |MSCTF        |              | (possible CtfImeCreateInputContext+857)         |                                                  |
|00000060|04     |0019FD08|006AEBD8|Project5.exe|002AEBD8|Vcl.StdCtrls.pas                     |Vcl.StdCtrls |TButtonControl|WndProc                                          |5164[13]                                         |
|00000020|04     |0019FD18|0069B9CC|Project5.exe|0029B9CC|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9786[3]                                          |
|00000020|04     |0019FD2C|0069B9F6|Project5.exe|0029B9F6|Vcl.Controls.pas                     |Vcl.Controls |TWinControl  |MainWndProc                                      |9789[6]                                          |
|00000060|04     |0019FD48|0051F93C|Project5.exe|0011F93C|System.Classes.pas                   |System.Classes|              |StdWndProc                                       |16882[8]                                         |
|00000060|03     |0019FD60|7453BF19|user32.dll |0003BF19|USER32.dll                           |USER32        |              | (possible AddClipboardFormatListener+1177)      |                                                  |
|00000060|03     |0019FD8C|745383E5|user32.dll |000383E5|USER32.dll                           |USER32        |              | (possible DispatchMessageW+2421)                |                                                  |
|00000020|03     |0019FDBC|7453FB21|user32.dll |0003FB21|USER32.dll                           |USER32        |              | (possible EndTask+6065)                         |                                                  |
|00000020|03     |0019FDC0|7453A67E|user32.dll |0003A67E|USER32.dll                           |USER32        |              | (possible SystemParametersInfoW+1102)           |                                                  |
|00000020|03     |0019FE0C|74538239|user32.dll |00038239|USER32.dll                           |USER32        |              | (possible DispatchMessageW+1993)                |                                                  |
|00000060|03     |0019FE74|74537C99|user32.dll |00037C99|USER32.dll                           |USER32        |              | (possible DispatchMessageW+553)                 |                                                  |
|00000020|04     |0019FED8|0073E321|Project5.exe|0033E321|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |CancelHint                                       |11181[6]                                         |
|00000060|03     |0019FEF0|74537A7B|user32.dll |00037A7B|USER32.dll                           |USER32        |              |DispatchMessageW                                 |                                                  |
|00000020|04     |0019FEFC|0073CFB3|Project5.exe|0033CFB3|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |ProcessMessage                                   |10352[23]                                        |
|00000020|04     |0019FF18|0073CFF6|Project5.exe|0033CFF6|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |HandleMessage                                    |10382[1]                                         |
|00004020|04     |0019FF3C|0073D329|Project5.exe|0033D329|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |Run                                              |10520[26]                                        |
|00004020|04     |0019FF44|0073D336|Project5.exe|0033D336|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |Run                                              |10520[26]                                        |
|00000030|04     |0019FF50|0073D371|Project5.exe|0033D371|Vcl.Forms.pas                        |Vcl.Forms    |TApplication |Run                                              |10527[33]                                        |
|00004020|04     |0019FF6C|00795049|Project5.exe|00395049|Project5.dpr                         |Project5      |              |Initialization                                   |26[4]                                            |
|7FFF7FFE|03     |0019FF84|758C8492|kernel32.dll|00018492|KERNEL32.DLL                         |KERNEL32      |              |BaseThreadInitThunk                              |                                                  |
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
While this is what we got in the Delphi XE8 debugger,
Code:
Unit10.TForm10.Button1Click($3426BB0)
Vcl.Controls.TControl.Click
Vcl.StdCtrls.TCustomButton.Click
Vcl.StdCtrls.TCustomButton.CNCommand(???)
Vcl.Controls.TControl.WndProc((48401, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.Controls.TWinControl.WndProc((48401, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.StdCtrls.TButtonControl.WndProc((48401, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.Controls.TControl.Perform(???,???,657518)
Vcl.Controls.DoControlMsg(???,(no value))
Vcl.Controls.TWinControl.WMCommand((273, (), 2158, 0, (), 657518, 0))
Vcl.Forms.TCustomForm.WMCommand((273, (), 2158, 0, (), 657518, 0))
Vcl.Controls.TControl.WndProc((273, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.Controls.TWinControl.WndProc((273, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.Forms.TCustomForm.WndProc((273, 2158, 657518, 0, 2158, 0, (), 2158, 10, (), 0, 0, ()))
Vcl.Controls.TWinControl.MainWndProc(???)
System.Classes.StdWndProc(1115926,273,2158,657518)
:7453bf1b ; C:\WINDOWS\SysWOW64\USER32.dll
:745383ea ; C:\WINDOWS\SysWOW64\USER32.dll
:7451beca ; C:\WINDOWS\SysWOW64\USER32.dll
:7451bc57 ; C:\WINDOWS\SysWOW64\USER32.dll
:7375e97f ; C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17134.706_none_42f0d9a244e0990d\comctl32.dll
:737897f1 ; C:\WINDOWS\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.17134.706_none_42f0d9a244e0990d\comctl32.dll
:7453bf1b ; C:\WINDOWS\SysWOW64\USER32.dll
:745383ea ; C:\WINDOWS\SysWOW64\USER32.dll
:74517afd USER32.CallWindowProcW + 0x8d
Vcl.Controls.TWinControl.DefaultHandler(???)
:0069c4c3 TWinControl.DefaultHandler + $EB
:0069c3b2 TWinControl.WndProc + $5EE
:006aebdd TButtonControl.WndProc + $71
:0051f93e StdWndProc + $16
:7453bf1b ; C:\WINDOWS\SysWOW64\USER32.dll
:745383ea ; C:\WINDOWS\SysWOW64\USER32.dll
:74537c9e ; C:\WINDOWS\SysWOW64\USER32.dll
:74537a80 USER32.DispatchMessageW + 0x10
and that is it, cut at DispatchMessageW which it could be recursive, caused by SendMessage form the application itself, (yes i know it might be was one but i am talking about a second from the message/event)

Hope that clear my point at last, and again sorry for your time.
  Mit Zitat antworten Zitat