Is there any way to find out which form a TCustomForm reference refers to?

天涯浪子 提交于 2019-12-24 16:05:20

问题


I have added madExcept support to my application referenced in this question. When the program hangs I get the following report from madTraceProcess:

date/time         : 2015-07-28, 09:21:06, 350ms
computer name     : ENG_LAB
user name         : user
registered owner  : Eng_Lab_2
operating system  : Windows 7 x64 Service Pack 1 build 7601
system language   : English
system up time    : 1 hour 3 minutes
program up time   : 54 minutes 6 seconds
processors        : 2x AMD A6-5350M APU with Radeon(tm) HD Graphics
physical memory   : 1938/3225 MB (free/total)
free disk space   : (C:) 240.37 GB
display mode      : 1366x768, 32 bit
process id        : $c88
allocated memory  : 41.85 MB
executable        : MyApp.exe
exec. date/time   : 2015-07-27 15:23
version           : 2.3.1.22
compiled with     : Delphi 2010
madExcept version : 3.0o
callstack crc     : $15a22a67, $cd1beee7, $cd1beee7

main thread ($1204):
0058c051 +031 MyApp.exe Forms     3331  +3 TCustomForm.DoDestroy
0058bec2 +052 MyApp.exe Forms     3296 +23 TCustomForm.Destroy
004b290e +07a MyApp.exe Classes  11827 +10 TComponent.DestroyComponents
00589e3d +035 MyApp.exe Forms     1773  +9 DoneApplication
00476142 +026 MyApp.exe SysUtils  3991  +6 DoExitProc
00407141 +065 MyApp.exe System   13380 +41 @Halt0
00de2936 +13a MyApp.exe MyApp    139 +17 initialization
75563378 +010 kernel32.dll                             BaseThreadInitThunk

thread $6e0: <priority:2>
75727c18 +45 USER32.dll                      GetMessageA
0046a945 +0d MyApp.exe madExcept CallThreadProcSafe
0046a9af +37 MyApp.exe madExcept ThreadExceptFrame
75563378 +10 kernel32.dll                    BaseThreadInitThunk
>> created by main thread ($1204) at:
755634a0 +1b kernel32.dll                    CreateThread

thread $34c:
77440152 +0e ntdll.dll     NtWaitForMultipleObjects
75563378 +10 kernel32.dll  BaseThreadInitThunk

thread $1a28:
77441f3b +0b ntdll.dll     NtWaitForWorkViaWorkerFactory
75563378 +10 kernel32.dll  BaseThreadInitThunk

modules:
00400000 MyApp.exe 2.3.1.22           C:\Program Files (x86)\MyAppFolder\MyApp
60c10000 gdiplus.dll           6.1.7601.18852     C:\Windows\WinSxS\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.7601.18852_none_72d5ba7586659cb4
61bf0000 msxml6.dll            6.30.7601.17988    C:\Windows\System32
61d50000 olepro32.dll          6.1.7601.17514     C:\Windows\system32
69020000 WindowsCodecs.dll     6.2.9200.17251     C:\Windows\system32
6a4c0000 hhctrl.ocx            6.1.7600.16385     C:\Windows\system32
6f1f0000 SXS.DLL               6.1.7601.17514     C:\Windows\system32
71160000 comctl32.dll          5.82.7601.18837    C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82.7601.18837_none_ec86b8d6858ec0bc
718a0000 comctl32.dll          6.10.7601.18837    C:\Windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7601.18837_none_41e855142bd5705d
71b60000 uxtheme.dll           6.1.7600.16385     C:\Windows\system32
71df0000 dwmapi.dll            6.1.7600.16385     C:\Windows\system32
71e70000 oleacc.dll            7.0.0.0            C:\Windows\system32
73260000 SHFolder.dll          6.1.7600.16385     C:\Windows\system32
73410000 wsock32.dll           6.1.7600.16385     C:\Windows\system32
736f0000 msimg32.dll           6.1.7600.16385     C:\Windows\system32
73700000 propsys.dll           7.0.7601.17514     C:\Windows\system32
73840000 winmm.dll             6.1.7601.17514     C:\Windows\system32
74340000 ntmarta.dll           6.1.7600.16385     C:\Windows\system32
74460000 winspool.drv          6.1.7601.17514     C:\Windows\system32
744c0000 version.dll           6.1.7600.16385     C:\Windows\system32
747e0000 RpcRtRemote.dll       6.1.7601.17514     C:\Windows\system32
747f0000 rsaenh.dll            6.1.7600.16385     C:\Windows\system32
74830000 CRYPTSP.dll           6.1.7600.16385     C:\Windows\system32
74a30000 RICHED20.DLL          5.31.23.1230       C:\Windows\system32
74e20000 CRYPTBASE.dll         6.1.7600.16385     C:\Windows\syswow64
74e30000 SspiCli.dll           6.1.7601.18798     C:\Windows\syswow64
74e90000 WS2_32.dll            6.1.7601.17514     C:\Windows\syswow64
74f60000 WLDAP32.dll           6.1.7601.17514     C:\Windows\syswow64
75010000 ole32.dll             6.1.7601.17514     C:\Windows\syswow64
75180000 SHLWAPI.dll           6.1.7601.17514     C:\Windows\syswow64
751f0000 CFGMGR32.dll          6.1.7601.17621     C:\Windows\syswow64
75220000 GDI32.dll             6.1.7601.18778     C:\Windows\syswow64
752c0000 ADVAPI32.dll          6.1.7601.18247     C:\Windows\syswow64
75360000 KERNELBASE.dll        6.1.7601.18847     C:\Windows\syswow64
753b0000 IMM32.DLL             6.1.7601.17514     C:\Windows\system32
75550000 kernel32.dll          6.1.7601.18847     C:\Windows\syswow64
75660000 CLBCatQ.DLL           2001.12.8530.16385 C:\Windows\syswow64
756f0000 profapi.dll           6.1.7600.16385     C:\Windows\syswow64
75710000 USER32.dll            6.1.7601.17514     C:\Windows\syswow64
75850000 shell32.dll           6.1.7601.18762     C:\Windows\syswow64
764a0000 comdlg32.dll          6.1.7601.17514     C:\Windows\syswow64
76530000 USP10.dll             1.626.7601.18009   C:\Windows\syswow64
767c0000 SETUPAPI.dll          6.1.7601.17514     C:\Windows\syswow64
76960000 oleaut32.dll          6.1.7601.18679     C:\Windows\syswow64
76a00000 msvcrt.dll            7.0.7601.17744     C:\Windows\syswow64
76ab0000 MSCTF.dll             6.1.7601.18731     C:\Windows\syswow64
76b80000 NSI.dll               6.1.7600.16385     C:\Windows\syswow64
76bc0000 RPCRT4.dll            6.1.7601.18532     C:\Windows\syswow64
76cb0000 sechost.dll           6.1.7600.16385     C:\Windows\SysWOW64
76ed0000 DEVOBJ.dll            6.1.7601.17621     C:\Windows\syswow64
773f0000 LPK.dll               6.1.7600.16385     C:\Windows\syswow64
77420000 ntdll.dll             6.1.7601.18798     C:\Windows\SysWOW64

processes:
0000 Idle                                  0 0   0
0004 System                                0 0   0
0128 smss.exe                              0 0   0
021c csrss.exe                             0 0   0
0288 wininit.exe                           0 0   0
0290 csrss.exe                             1 0   0
02b8 services.exe                          0 0   0
02d0 lsass.exe                             0 0   0
02d8 lsm.exe                               0 0   0
0310 winlogon.exe                          1 0   0
0370 svchost.exe                           0 0   0
03b0 TrueSuiteService.exe                  0 0   0
03e0 ibmpmsvc.exe                          0 0   0
0144 svchost.exe                           0 0   0
0284 atiesrxx.exe                          0 0   0
040c svchost.exe                           0 0   0
0430 svchost.exe                           0 0   0
0448 svchost.exe                           0 0   0
0460 svchost.exe                           0 0   0
04dc svchost.exe                           0 0   0
058c svchost.exe                           0 0   0
065c atieclxx.exe                          1 0   0
0670 wlanext.exe                           0 0   0
069c conhost.exe                           0 0   0
071c spoolsv.exe                           0 0   0
0738 svchost.exe                           0 0   0
0794 armsvc.exe                            0 0   0
07c4 CxAudMsg64.exe                        0 0   0
07f4 FBService.exe                         0 0   0
04f0 svchost.exe                           0 0   0
0264 PresentationFontCache.exe             0 0   0
0810 AgentMon.exe                          0 0   0
0828 AdAwareService.exe                    0 0   0
0870 LavasoftTcpService.exe                0 0   0
0890 CamMute.exe                           0 0   0
08ac TPKNRSVC.exe                          0 0   0
08c4 vcamsvc.exe                           0 0   0
0af4 lvvsst.exe                            0 0   0
0b0c NitroPDFDriverService8x64.exe         0 0   0
0b58 NLSSRV32.EXE                          0 0   0
0bd4 SASrv.exe                             0 0   0
0cb8 svchost.exe                           0 0   0
0cd0 TPHKSVC.exe                           0 0   0
0cf4 ULCDRSvr.exe                          0 0   0
0d50 tphkload.exe                          0 0   0
0d68 micmute.exe                           0 0   0
0e0c tpnumlk.exe                           1 0   0
0e5c WmiPrvSE.exe                          0 0   0
0e58 WmiPrvSE.exe                          0 0   0
0ea8 unsecapp.exe                          0 0   0
0fd8 taskhost.exe                          1 26  20  normal
0a88 virtscrl.exe                          1 0   0
0dac rundll32.exe                          1 0   0
0f54 TouchControl.exe                      1 251 99  normal
0f84 mkrmsg.exe                            1 9   3   normal
0f8c dwm.exe                               1 17  2   high
1020 explorer.exe                          1 613 376 normal
110c TPONSCR.EXE                           1 49  4   normal       C:\PROGRA~1\Lenovo\HOTKEY
1118 tpnumlkd.exe                          1 0   0
11fc CAudioFilterAgent64.exe               1 14  7   normal
1208 fmapp.exe                             1 9   4   normal
1210 TpShocks.exe                          1 22  11  normal
1218 TpKnrres.exe                          1 12  10  normal       C:\Program Files\Lenovo\Communications Utility
1278 SynTPEnh.exe                          1 100 58  above normal
12c8 AdAwareTray.exe                       1 74  16  normal
12d0 WebCompanion.exe                      1 33  31  normal       C:\Program Files (x86)\Lavasoft\Web Companion\Application
13c4 rundll32.exe                          1 4   1   normal       C:\Windows\SysWOW64
13f4 rundll32.exe                          1 62  12  normal
1184 SynTPLpr.exe                          1 9   4   normal
11b4 KaUsrTsk.exe                          1 9   9   normal       C:\Program Files (x86)\SpireTech\SPRTCH24362552940339
11c8 BrStMonW.exe                          1 62  63  normal       C:\Program Files (x86)\Browny02\Brother
1268 SCHTASK.exe                           1 10  5   normal       C:\PROGRA~2\ThinkPad\UTILIT~1
133c BrCtrlCntr.exe                        1 9   1   normal       C:\Program Files (x86)\ControlCenter4
064c BrCcUxSys.exe                         1 19  10  normal       C:\Program Files (x86)\ControlCenter4
0fa0 taskeng.exe                           1 9   3   normal
13cc ismagent.exe                          1 12  14  below normal C:\Program Files (x86)\Intel\IntelAppStore\bin
1414 pcee4.exe                             1 14  10  below normal
1778 SearchIndexer.exe                     0 0   0
17f8 BrYNSvc.exe                           0 0   0
0094 Lua.exe                               0 0   0
10fc Lua.exe                               0 0   0
16d8 conhost.exe                           0 0   0
01c8 Kaseya.AgentEndpoint.exe              0 0   0
081c conhost.exe                           0 0   0
0dd4 conhost.exe                           0 0   0
16dc SynTPHelper.exe                       1 0   0
1804 svchost.exe                           0 0   0
1844 unsecapp.exe                          1 9   3   normal
19d4 BioMonitor.exe                        1 9   4   normal       C:\Program Files\Lenovo Fingerprint Reader\x86
10a4 mcplaunch.exe                         1 4   1   idle         C:\Program Files (x86)\Lenovo\message center plus
16c8 Lavasoft.SearchProtect.WinService.exe 0 0   0
142c wuauclt.exe                           1 12  7   normal
1bbc PsiService_2.exe                      0 0   0
0d14 chrome.exe                            1 40  46  normal       C:\Program Files (x86)\Google\Chrome\Application
1708 chrome.exe                            1 10  7   normal       C:\Program Files (x86)\Google\Chrome\Application
1dc0 chrome.exe                            1 4   1   normal       C:\Program Files (x86)\Google\Chrome\Application
0c88 MyApp.exe                 1 375 186 normal       C:\Program Files (x86)\MyAppFolder\MyApp
11f4 FP23DB~2.EXE                          1 229 105 normal       C:\PROGRA~2\MyAppF~1
1e34 splwow64.exe                          1 9   2   normal
1bcc WINWORD.EXE                           1 253 88  normal       C:\Program Files (x86)\Microsoft Office\Office12
1984 taskmgr.exe                           1 129 112 high
1efc audiodg.exe                           0 0   0
0b50 madTraceProcess.exe                   1 36  23  normal       C:\Users

hardware:
+ Batteries
  - Microsoft AC Adapter
  - Microsoft ACPI-Compliant Control Method Battery
  - Microsoft Composite Battery
+ Computer
  - ACPI x64-based PC
+ Disk drives
  - WDC WD32 00LPVX-08V0TT5 SATA Disk Device
+ Display adapters
  - AMD Radeon HD 8450G (driver 12.102.1.8000)
+ DVD/CD-ROM drives
  - PLDS DVD-RW DS8A9SH SATA CdRom Device
+ Human Interface Devices
  - USB Input Device
+ IDE ATA/ATAPI controllers
  - AMD SATA Controller (driver 1.2.1.331)
+ Imaging devices
  - Brother MFC-J6710DW LAN (driver 1.1.24.21)
  - Camera Plus (VGA Resolution Maximum) (driver 1.0.1.1)
  - Integrated Camera
+ Jungo Connectivity
  - WinDriver (driver 11.5.0.0)
+ Keyboards
  - Standard PS/2 Keyboard
+ Memory technology driver
  - Realtek PCIE CardReader (driver 6.1.7601.29005)
+ Mice and other pointing devices
  - HID-compliant mouse
  - ThinkPad UltraNav Pointing Device (driver 16.4.0.3)
+ Monitors
  - LCD 1366x768 (driver 5.7.0.0)
+ Network adapters
  - Microsoft Virtual WiFi Miniport Adapter
  - Realtek PCIe GBE Family Controller (driver 7.48.823.2011)
  - Realtek RTL8188E Wireless LAN 802.11n PCI-E NIC (driver 2007.8.201.2013)
+ Ports (COM & LPT)
  - USB Serial Port (COM3) (driver 2.12.0.0)
  - USB Serial Port (COM5) (driver 2.12.0.0)
+ Processors
  - AMD A6-5350M APU with Radeon(tm) HD Graphics
  - AMD A6-5350M APU with Radeon(tm) HD Graphics
+ SM Driver
  - SM bios service (driver 6.1.1020.0)
  - SM bus service (driver 6.5.1018.0)
+ Sound, video and game controllers
  - AMD High Definition Audio Device (driver 7.12.0.7714)
  - Conexant 20671 SmartAudio HD (driver 8.54.48.0)
+ Storage volume shadow copies
  - Generic volume shadow copy
+ System devices
  - ACPI Fixed Feature Button
  - ACPI Lid
  - ACPI Power Button
  - AMD SMBus (driver 5.12.0.15)
  - BitDefender AVC HV (driver 3.10.7096.4224)
  - Composite Bus Enumerator
  - Direct memory access controller
  - File as Volume Driver
  - High Definition Audio Controller
  - High Definition Audio Controller
  - Lenovo PM Device (driver 1.67.10.15)
  - Microsoft ACPI-Compliant Embedded Controller
  - Microsoft ACPI-Compliant System
  - Microsoft System Management BIOS Driver
  - Microsoft Virtual Drive Enumerator Driver
  - Microsoft Windows Management Interface for ACPI
  - Motherboard resources
  - Motherboard resources
  - Numeric data processor
  - PCI bus
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard host CPU bridge
  - PCI standard ISA bridge
  - PCI standard PCI-to-PCI bridge
  - PCI standard PCI-to-PCI bridge
  - PCI standard PCI-to-PCI bridge
  - PCI standard PCI-to-PCI bridge
  - Plug and Play Software Device Enumerator
  - Programmable interrupt controller
  - Remote Desktop Device Redirector Bus
  - Synaptics SMBus Driver (driver 16.4.0.3)
  - System board
  - System CMOS/real time clock
  - System speaker
  - System timer
  - Terminal Server Keyboard Driver
  - Terminal Server Mouse Driver
  - UMBus Enumerator
  - UMBus Root Bus Enumerator
  - Volume Manager
+ Universal Serial Bus controllers
  - AMD USB 3.0 Host Controller (driver 1.1.0.128)
  - AMD USB 3.0 Host Controller (driver 1.1.0.128)
  - AMD USB 3.0 Root Hub (driver 1.1.0.128)
  - AMD USB 3.0 Root Hub (driver 1.1.0.128)
  - Standard Enhanced PCI to USB Host Controller
  - Standard Enhanced PCI to USB Host Controller
  - Standard OpenHCD USB Host Controller
  - Standard OpenHCD USB Host Controller
  - USB Composite Device
  - USB Root Hub
  - USB Root Hub
  - USB Root Hub
  - USB Root Hub
  - USB Serial Converter (driver 2.12.0.0)
  - USB Serial Converter (driver 2.12.0.0)

disassembling:
[...]
0058c03f        push    dword ptr fs:[eax]
0058c042        mov     fs:[eax], esp
0058c045 3331   mov     ebx, [ebp-4]
0058c048        mov     edx, [ebp-4]
0058c04b        mov     eax, [ebx+$33c]
0058c051      > call    dword ptr [ebx+$338]
0058c057        xor     eax, eax
0058c059        pop     edx
0058c05a        pop     ecx
0058c05b        pop     ecx
0058c05c        mov     fs:[eax], edx
[...

It looks (to my inexperienced eye) like the program is hanging in an OnDestroy event handler but it isn't obvious which form is causing the trouble. Is there a way to determine which form is stalled?


回答1:


Write a debug version of the app that outputs to a log file - For all 'onDestroy' events in code add a log message for OnDestroy Start TMyForm1 and OnDestroy End TMyForm2. Alternatively you'll need to rename your OnDestroy routines to something unique.

That being said, OnDestroy doesn't appear in your call stack (OnDestroy<>DoDestroy). It does look as though you may have a double-free problem as @David Schwartz suggests. Again, easiest way to deal with this on a remote machine is to log each form create and destroy to a file and pair them up.




回答2:


Whenever I see this, it tells me I've got a form that was created automatically that is being freed explicitly somewhere.

If the app is automatically creating the forms, then let it free them as well.



来源:https://stackoverflow.com/questions/31683682/is-there-any-way-to-find-out-which-form-a-tcustomform-reference-refers-to

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!