Link to home
Start Free TrialLog in
Avatar of LeTay
LeTay

asked on

Strange "random" exception in a Delphi 2009 application

In one "large" (100.000 lines of code + 3rd party libs) Delphi application, I get the following Madshi stack traceS (message in french, sorry, means access violation at address ...)
What is very strange is the following : the crashes occur when "apparently" calling function gm2000Dispatch, as the trace is not inside the function gm2000Dispatch code which, by the way, in inside the same unit U2000A

exception class   : EAccessViolation
exception message : Violation d'acc¿s ¿ l'adresse 00404B95 dans le module 'Gm2000.exe'. Lecture de l'adresse FFFFFFFE.

main thread ($898):
00404b95 +00d Gm2000.exe   System    903  +0 GetDynaMethod
00404bbc +004 Gm2000.exe   System    903  +0 @CallDynaInst
004cfd3e +012 Gm2000.exe   Controls          TControl.SetVisible
004b616e +03a Gm2000.exe   Forms             TCustomForm.SetVisible
004babc3 +007 Gm2000.exe   Forms             TCustomForm.Show
0075ba0f +0c3 Gm2000.exe   U2000A   1779  +9 gm2000Dispatch
00763009 +039 Gm2000.exe   U2000A   3426  +1 TF2000A.MenuLotInformationClick
004c5fbb +0a7 Gm2000.exe   Menus             TMenuItem.Click
004c726f +013 Gm2000.exe   Menus             TMenu.DispatchCommand
004b9917 +01f Gm2000.exe   Forms             TCustomForm.WMCommand
004d1542 +2d2 Gm2000.exe   Controls          TControl.WndProc
004d5a47 +513 Gm2000.exe   Controls          TWinControl.WndProc
004b6878 +594 Gm2000.exe   Forms             TCustomForm.WndProc
004d5160 +02c Gm2000.exe   Controls          TWinControl.MainWndProc
00485e68 +014 Gm2000.exe   Classes           StdWndProc
766b8e97 +00a USER32.dll                     DispatchMessageW
004bef8d +11d Gm2000.exe   Forms             TApplication.ProcessMessage
004befd2 +00a Gm2000.exe   Forms             TApplication.HandleMessage
004bf2fd +0c9 Gm2000.exe   Forms             TApplication.Run
00768e20 +1a4 Gm2000.exe   Gm2000    285 +30 initialization
75fe1172 +010 kernel32.dll                   BaseThreadInitThunk

Sometime, I get this (in the same user action context)
exception class   : EAccessViolation
exception message : Violation d'acc¿s ¿ l'adresse 00000000. Lecture de l'adresse 00000000.

main thread ($d8):
00000000 +000 ???
00485e68 +014 GM2000.EXE Classes           StdWndProc
004cc544 +0fc GM2000.EXE Controls          InitWndProc
7c91eae0 +010 ntdll.dll                    KiUserCallbackDispatcher
77d1ff7e +02e USER32.dll                   CreateWindowExW
0040b413 +03f GM2000.EXE Windows           CreateWindowEx
004d4884 +030 GM2000.EXE Controls          TWinControl.CreateWindowHandle
004b8844 +0fc GM2000.EXE Forms             TCustomForm.CreateWindowHandle
004d47a1 +139 GM2000.EXE Controls          TWinControl.CreateWnd
004b486d +005 GM2000.EXE Forms             TScrollingWinControl.CreateWnd
004b8556 +00a GM2000.EXE Forms             TCustomForm.CreateWnd
004d4baa +016 GM2000.EXE Controls          TWinControl.CreateHandle
004d872c +01c GM2000.EXE Controls          TWinControl.HandleNeeded
004d8739 +005 GM2000.EXE Controls          TWinControl.GetHandle
004b7354 +00c GM2000.EXE Forms             TCustomForm.GetMonitor
004b7bbc +088 GM2000.EXE Forms             TCustomForm.SetWindowToMonitor
004b6165 +031 GM2000.EXE Forms             TCustomForm.SetVisible
004babc3 +007 GM2000.EXE Forms             TCustomForm.Show
0075ba0f +0c3 GM2000.EXE U2000A   1779  +9 gm2000Dispatch
00763009 +039 GM2000.EXE U2000A   3426  +1 TF2000A.MenuLotInformationClick
004c5fbb +0a7 GM2000.EXE Menus             TMenuItem.Click
004c726f +013 GM2000.EXE Menus             TMenu.DispatchCommand
004b9917 +01f GM2000.EXE Forms             TCustomForm.WMCommand
004d1542 +2d2 GM2000.EXE Controls          TControl.WndProc
004d56ca +196 GM2000.EXE Controls          TWinControl.WndProc
004b6878 +594 GM2000.EXE Forms             TCustomForm.WndProc
004d5160 +02c GM2000.EXE Controls          TWinControl.MainWndProc
00485e68 +014 GM2000.EXE Classes           StdWndProc
77d18a0b +00a USER32.dll                   DispatchMessageW
004bef8d +11d GM2000.EXE Forms             TApplication.ProcessMessage
004befd2 +00a GM2000.EXE Forms             TApplication.HandleMessage
004bf2fd +0c9 GM2000.EXE Forms             TApplication.Run
00768e20 +1a4 GM2000.EXE Gm2000    285 +30 initialization

On another trace, I get an Abstract Error (trace not currently available)

Same user action, different crash
The problems for me to fix this are :
1. is this real that a simple function call can crash before being inside the function, as it looks to be here ?
2. I can't reproduce the problem on my development PC, neither in debug mode in the IDE, nor outside, executing the .exe

How can I find what's wrong there ?
(that application has run for years and I made changes from time to time, this time there were many changes but I can't figure out what makes it fail now)
Avatar of Geert G
Geert G
Flag of Belgium image

have you tried starting the app with F8
and then menu search / find error > 00404B95
and see what line you get  ?

in debug options checking "use debug dcus" and recompile may help to indicate the source line
Avatar of LeTay
LeTay

ASKER

I could not locate "find error" in debug mode, search ...
Can you tell me precisely where the use debug dcu option is located ? I have a french version of Delphi
Thanks
ps : in debug mode and in general in the IDE, I never had that error happening
If the error was not happening before then I would recompile as it was before.  Add in one section of new code changes at a time and let the process tell you where the error is occurring.
find error is the bottom option of the search menu
Avatar of LeTay

ASKER

Well, not on my Delphi 2009
There is no find error in the Search sub-menu, even grayed ...
There is however a goto address : is this what you mean

I am also interested in the "user debug dcu" but can't locate it
Avatar of LeTay

ASKER

What is worrying me is that it seems that the exception occurs on a function call and not inside that function code itself, which is probably the place where it really happens
use debug dcus option can be found in compiler options
if you have source code of native delphi units like 'classes.pas' then you can debug into those units too

goto address, yes, name was changed and i didn't have delphi yesterday :)
Avatar of LeTay

ASKER

About "use debug DCU", i suppose you mean that, if I set this option, later on at execution, it is crashes inside such unit, Madshi will report it ?
ASKER CERTIFIED SOLUTION
Avatar of Geert G
Geert G
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LeTay

ASKER

Goto give something but like this :  ?????
Avatar of LeTay

ASKER

I changed the "use debug dcus" option to ON
When I build the project, I now get an error
It says that unit TEEngine was compiled with another version (of Delphi)
This unit is part of TEEChart that I use in the application
I guess I will have to upgrade to Delphi 2009 for having the compilation completed ...