PDA

View Full Version : EurekaLog doesn't catch AV in Delphi 2006


Brent
11-Dec-2007, 03:44 PM
I downloaded the EurekaLog 6 from their website yesterday to see if it
can catch an AV I'm getting in BDS2006. EurekaLog is installed properly
and the conditional variables are in the project options. If I add my
own exception to the program EurekaLog catches it fine. But when I let
the program run my bad code, I see the usual "Project: ... faulted with
a message: "access violation at 0x32393130: read of address 0x3293130'.
Process Stopped. Use Step or Run to continue".

If I press "OK" (the only button on the Debugger Fault Notification
dialog), then the error continues to pop up. EurekaLog dialog is nowhere
to be seen. I can't get out of the program because this dialog keeps
re-appearing.

So is there an option I can activate to get EurekaLog to trap this
error? TIA

Brent

admin
11-Dec-2007, 04:07 PM
Hi,

do you have activated EurekaLog from the "Project/EurekaLog options.../Activate EurekaLog" menu?

If you have just done this the try to create and send to me a littpe source demo able to reproduce this issue to me.

Brent
11-Dec-2007, 04:26 PM
admin wrote:

> Hi,
>
> do you have activated EurekaLog from the "Project/EurekaLog
> options.../Activate EurekaLog" menu?

Yes, it is activated.

>
> If you have just done this the try to create and send to me a littpe
> source demo able to reproduce this issue to me.

Now if I could find the code that is causing the problem, I'd be happy
to. :)

I've resorted to debugging it line by line in my routine. Will let you know.

Brent

admin
11-Dec-2007, 04:40 PM
OK,

I'm waiting for your feedback!

Brent
12-Dec-2007, 04:06 PM
admin wrote:
> OK,
>
> I'm waiting for your feedback!
>
>

Admin,

I've discovered the code that threw the exception. I was using a
SetTextBuf when writing a text file, but the buffer aTextFileBuf was not
passed as a Var to PrepareFile(). I created a sample program and it
generates the AV after several writeln's are executed.

Unfortunately EurekaLog catches it in this demo program so I don't know
why it didn't catch it in my other program.

Brent
BDS2006




procedure PrepareFile(var aFOut : TextFile;
aFileName : String;
aWantBuf : Boolean;
aTextFileBuf: TTextFileBuf);

begin
AssignFile(aFOut, aFileName);
if aWantBuf then
System.SetTextBuf(aFOut, aTextFileBuf);
Rewrite(aFOut);
end;



procedure TForm1.StartClick(Sender: TObject);
const
cStr='0123456789 abcdefghijklmnopqrstuvwxyz 0123456789
ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789 abcdefghijklmnopqrstuvwxyz
0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ';
var
FText : TextFile;
FBuf : TTextFileBuf;
NumRows,
i : Integer;

begin
NumRows := StrToInt(edNumRows.Text);
PrepareFile(FText, 'Test.Txt', cbBuffer.Checked, FBuf);

with ProgressBar1 do
begin
Position := 0;
Max := NumRows;
end;

for i:=1 to NumRows do
begin
writeln(FText, i,':', cStr);
if i mod 100 = 0 then
ProgressBar1.Position := i;
end;
CloseFile(FText);
ShowMessage('Completed');
end;

admin
13-Dec-2007, 06:50 AM
Hi,

I'm sorry but so I cannot help you.

If you want I can connect with your PC using our remote support tool, so to can definitely check the problem on your PC, ok?

To allow me to connect directly with your PC you must only download and run our remote control tool (http://www.eurekalog.com/files/EurekaLog_Remote_Support.exe).

It is only a simple TCP client (NOT server), working on the HTTPS ports, so it works with any firewall and local network configuration.

Brent
13-Dec-2007, 04:05 PM
admin wrote:
> Hi,
>
> I'm sorry but so I cannot help you.
>
> If you want I can connect with your PC using our remote support tool,
> so to can definitely check the problem on your PC, ok?
>
> To allow me to connect directly with your PC you must only download and
> run our remote control tool
> (http://www.eurekalog.com/files/EurekaLog_Remote_Support.exe).
>
> It is only a simple TCP client (NOT server), working on the HTTPS
> ports, so it works with any firewall and local network configuration.
>
>

Admin,
Thanks for the offer, but it is not necessary. I discovered what
was causing the exception so that solved the problem. I'll keep using
EurekaLog to see if it misses any more exceptions.

Brent

admin
14-Dec-2007, 07:55 AM
OK,

but can you explain to me the nature of your error, please?

Brent
18-Dec-2007, 05:15 AM
admin wrote:

> OK,
>
> but can you explain to me the nature of your error, please?
>
>

Sure. The problem was caused by passing aTextFileBuf by value instead of
by address. So the following routine assigned the SetTextBuf to a copy
of aTextFileBuf that was destroyed when the routine exited, but the
program still tried to use the buffer later on when the writeln's were
executed. EurekaLog caught the problem in the test program I wrote but
not in the actual program (I still don't know why). I solved the problem
by passing aTextFileBuf by address and it works fine.

Brent

procedure PrepareFile(var aFOut : TextFile;
aFileName : String;
aWantBuf : Boolean;
aTextFileBuf: TTextFileBuf);
begin
AssignFile(aFOut, aFileName);
if aWantBuf then
System.SetTextBuf(aFOut, aTextFileBuf);
Rewrite(aFOut);
end;

admin
18-Dec-2007, 02:30 PM
Hi,

OK, thank you.

I'm studying on! :)