chrislock
asked on
Madexcept no bugreport
Hi
D7 XP
I wrote a quick app containing a threaded timer to test Madexcept.
Why does it not detect the identical range error in the timer section? (arr[1..10])
procedure TForm1.ThreadedTimer1Timer (Sender: TObject);
var
x:integer;
begin
x:=1000; // No bugreport
arr[x]:=1;
end;
procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
x:=1000;
arr[x]:=1; // Bugreport OK
ThreadedTimer1.Enabled:=tr ue;
end;
D7 XP
I wrote a quick app containing a threaded timer to test Madexcept.
Why does it not detect the identical range error in the timer section? (arr[1..10])
procedure TForm1.ThreadedTimer1Timer
var
x:integer;
begin
x:=1000; // No bugreport
arr[x]:=1;
end;
procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
x:=1000;
arr[x]:=1; // Bugreport OK
ThreadedTimer1.Enabled:=tr
end;
What is your timer interval???
ASKER
1 second
ASKER
have just increased to 5 - no change
I have activated madexcept and tried out your code.
Do not get any bug report in either of the two cases.
No bugreport in FormCreate and no bug report in timer event!!!
My array ist defined as follows:
var
arr: array [1..10] of integer;
What about the definition of your array???
Do not get any bug report in either of the two cases.
No bugreport in FormCreate and no bug report in timer event!!!
My array ist defined as follows:
var
arr: array [1..10] of integer;
What about the definition of your array???
OK, after activating Range checking in Compiler options, I do get bug reports , both in Formcreate and in timer event ThreadedTimer1Timer...
I'm working with madexcept 3.0h.
What is you madexcept version???
What is you madexcept version???
Do you have range check activated in Compiler options???
ASKER
same as yours -
check that 'project compiler options Range checking enabled' and 'tools debugger options - integrated debugging and lang exceptions - stop on Delphi exceptions' checked.
Disable Madexcept and run - Delphi will give 'range check err' on formcreate
uncheck stop on Delphi exceptions.
Now enable madexcept and recompile and run - Madexcept gives bugreport on formcreate but not on the timer section.
check that 'project compiler options Range checking enabled' and 'tools debugger options - integrated debugging and lang exceptions - stop on Delphi exceptions' checked.
Disable Madexcept and run - Delphi will give 'range check err' on formcreate
uncheck stop on Delphi exceptions.
Now enable madexcept and recompile and run - Madexcept gives bugreport on formcreate but not on the timer section.
Try to set yout compiler options according to mine and let's see if it also works for you...
CompilerOptions.JPG
CompilerOptions.JPG
ASKER
Out of sync!!
3.0l (latest)
Yes my post
Yes range check activated
3.0l (latest)
Yes my post
Yes range check activated
ASKER
I have changed my compiler options to yours and no difference. madexcept catches first error but not the timer error.
ASKER
I have a feeling that Madexcept is producing the report but not displaying it for some reason
ASKER
Thommy - do you get the same results?
Comment out arr[x]:=1 in FormCreate:
//arr[x]:=1
Now you will get the bug report in Timer event.
MadExcept captures the first range error in FormCreate and then exits FormCreate if you press "Continue application".
Your timer gets not enabled, because the line "ThreadedTimer1.Enabled:=t rue;" will not be carried out;
Change the two lines from FormCreate to call "ThreadedTimer1.Enabled:=t rue;" before "arr[x]:=1", and you will get bug reports for both...
//arr[x]:=1
Now you will get the bug report in Timer event.
MadExcept captures the first range error in FormCreate and then exits FormCreate if you press "Continue application".
Your timer gets not enabled, because the line "ThreadedTimer1.Enabled:=t
Change the two lines from FormCreate to call "ThreadedTimer1.Enabled:=t
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
You may be correct - However - we are not running the same code.
I have just changed the threaded timer to a standard one and everything works as expected.
This is the threadedtimer I wish to use http://www.carlosb.com/ctrl.php?fm=delphicomps
There must be something odd within the source.
I have just changed the threaded timer to a standard one and everything works as expected.
This is the threadedtimer I wish to use http://www.carlosb.com/ctrl.php?fm=delphicomps
There must be something odd within the source.
It's not a question of the timer component.
The point is, that the actual block is aborted after an exception (FormCreate-Block) and therefore the timer does not get enabled.
If you enable the timer at design time or set timer property "ENABLED" before the line, which produces the error, you will get both bug reports when continuing the app...
The point is, that the actual block is aborted after an exception (FormCreate-Block) and therefore the timer does not get enabled.
If you enable the timer at design time or set timer property "ENABLED" before the line, which produces the error, you will get both bug reports when continuing the app...
ASKER
OK - I will try exactly as you have stated
ASKER
I am correct - Madexcept will not give an exception on this timer section if you use the Threaded timer component. It runs normally with an ordinary timer.
You can see that the timer section runs by putting a breakpoint in.
As I said before, there must be something odd within the component source (which you can get free from the link above)
I've had a look at it but I cant see anything wrong.
I would just like to find out what it is!!!!!
Chris
You can see that the timer section runs by putting a breakpoint in.
As I said before, there must be something odd within the component source (which you can get free from the link above)
I've had a look at it but I cant see anything wrong.
I would just like to find out what it is!!!!!
Chris
To check if the timer is active you can place a label on your form and toogle its caption in the first line of the timer event:
with label1 do
if caption='2' then caption:='1' else caption:='2';
with label1 do
if caption='2' then caption:='1' else caption:='2';
ASKER
I've done that - the problem is definitely within the component - it must somehow prevent Madexcept working properly. I have used this component in several projects without a problem and I dont want to change the component to suit the debugger!!
ASKER
I've just installed Eurekalog - exactly the same results!!!
ASKER
If I disable Eurekalog (and Madexcept) and enable 'tools - stop on delphi exeptions', the Delphi IDE picks up the range check error in the timer section with no problems - What on earth is happening?
Thommy-have you tried this comonent?
Thommy-have you tried this comonent?
Sorry, for late feedback!!! Was prevented to get back because of a long meeting.
No, I don't know Eurekalog.
But range check can only be detected and caught, if timer event is called!!!
Have you checked, if timer event is really carried out!!!
You stated that you have checked that by toggling a test label, but you haven't told me what the result was.
Can you see a change of the label.caption, which would prove, that the code in timer event is really carried out???
Please provide sources of your current FormCreate and timer event (ThreadedTimer1Timer).
No, I don't know Eurekalog.
But range check can only be detected and caught, if timer event is called!!!
Have you checked, if timer event is really carried out!!!
You stated that you have checked that by toggling a test label, but you haven't told me what the result was.
Can you see a change of the label.caption, which would prove, that the code in timer event is really carried out???
Please provide sources of your current FormCreate and timer event (ThreadedTimer1Timer).
ASKER
Ok - have to go myself now - will get back in 15 hrs with sources
ASKER
Put a listbox and a timer on an empty form. My timer is a JVthreadtimer, but you can use a standard timer.
Set timer to 1000 ms.
If you comment out the arr[x]:=1 then no problems, otherwise both delphi debugger and Madexcept will find both errors.
If you replace the timer with http://www.carlosb.com/ctrl.php?fm=delphicomps and recompile then Delphi will pick up both range errors but Madexcept (and Eurekalog) will only pick up the error on formcreate.(disable delphi stop on error when using Madexcept)
This is my problem!!!!
Source as follows:
unit exep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ThdTimer, ExtCtrls,
JvThreadTimer, JvComponentBase;
type
TForm1 = class(TForm)
ListBox1: TListBox;
JvThreadTimer1: TJvThreadTimer;
procedure ThreadedTimer1Timer(Sender : TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
arr:array[1..10] of integer;
implementation
{$R *.dfm}
procedure TForm1.ThreadedTimer1Timer (Sender: TObject);
var
x:integer;
begin
x:=1000;
arr[x]:=1; // ERROR HERE
listbox1.Items.add('XXX');
end;
procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
x:=1000;
JvThreadTimer1.Enabled:=tr ue;
arr[x]:=1; // ERROR HERE
end;
end.
Set timer to 1000 ms.
If you comment out the arr[x]:=1 then no problems, otherwise both delphi debugger and Madexcept will find both errors.
If you replace the timer with http://www.carlosb.com/ctrl.php?fm=delphicomps and recompile then Delphi will pick up both range errors but Madexcept (and Eurekalog) will only pick up the error on formcreate.(disable delphi stop on error when using Madexcept)
This is my problem!!!!
Source as follows:
unit exep;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ThdTimer, ExtCtrls,
JvThreadTimer, JvComponentBase;
type
TForm1 = class(TForm)
ListBox1: TListBox;
JvThreadTimer1: TJvThreadTimer;
procedure ThreadedTimer1Timer(Sender
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
arr:array[1..10] of integer;
implementation
{$R *.dfm}
procedure TForm1.ThreadedTimer1Timer
var
x:integer;
begin
x:=1000;
arr[x]:=1; // ERROR HERE
listbox1.Items.add('XXX');
end;
procedure TForm1.FormCreate(Sender: TObject);
var x:integer;
begin
x:=1000;
JvThreadTimer1.Enabled:=tr
arr[x]:=1; // ERROR HERE
end;
end.
ASKER
Is there no-one out there????
I've looked at the source code of 2 timers JvThread timer, and ThdTimer (carlosB).
Is it true that if you do not handle any exception (Tthreadedtimer), whilst the timer is in its event, then any exception that occurs will not be picked up by Madexcept?
NOTE the lines
' if Assigned(ApplicationHandle Exception) then
ApplicationHandleException (Self);'
in the JVthreadtimer.
************************** *******
procedure TJvThreadTimer.DoOnTimer;
begin
if csDestroying in ComponentState then
Exit;
try
if Assigned(FOnTimer) then
FOnTimer(Self);
except
if Assigned(ApplicationHandle Exception) then
ApplicationHandleException (Self);
end;
end;
************************** ********** ********** ***
procedure TThreadedTimer.DoTimer;
begin
// We have to check FEnabled in the primary thread
// Otherwise we get AV when the program is closed
if FEnabled and Assigned(FOnTimer) and not (csDestroying in ComponentState) then
try
FOnTimer(Self);
except // NOT HANDLED!!!
end;
end;
I've looked at the source code of 2 timers JvThread timer, and ThdTimer (carlosB).
Is it true that if you do not handle any exception (Tthreadedtimer), whilst the timer is in its event, then any exception that occurs will not be picked up by Madexcept?
NOTE the lines
' if Assigned(ApplicationHandle
ApplicationHandleException
in the JVthreadtimer.
**************************
procedure TJvThreadTimer.DoOnTimer;
begin
if csDestroying in ComponentState then
Exit;
try
if Assigned(FOnTimer) then
FOnTimer(Self);
except
if Assigned(ApplicationHandle
ApplicationHandleException
end;
end;
**************************
procedure TThreadedTimer.DoTimer;
begin
// We have to check FEnabled in the primary thread
// Otherwise we get AV when the program is closed
if FEnabled and Assigned(FOnTimer) and not (csDestroying in ComponentState) then
try
FOnTimer(Self);
except // NOT HANDLED!!!
end;
end;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks all -
I managed to get the hang of the CPU panes and I realised what was happening in the end. The registerhiddenexceptions will be handy!
I have split the points.
I managed to get the hang of the CPU panes and I realised what was happening in the end. The registerhiddenexceptions will be handy!
I have split the points.