View Full Version : no stack info from dynamically loaded packages
Trond Morken
07-Sep-2006, 09:06 AM
Hello, I'm loading packages dynamically in my program, but I'm not able to
get correct stack info when the error occurs in a package. I have enabled
the eurekalog in the pbl and in the application. The IDE catches the
exception and goes to the correct line in the bpl, but Eurekalog is not able
to locate this.
If I build my application with runtime packages everyting works just fine,
but that is not an option for me.
Sample from application:
procedure TForm14.Button1Click(Sender: TObject);
var
MyPackage: HModule;
MyProc: procedure;
begin
MyPackage:=LoadPackage('Package1.bpl');
if MyPackage <> 0 then
try
@MyProc:=GetProcAddress(MyPackage, 'MakeError');
if Assigned(MyProc) then begin
MyProc;
end;
finally
UnloadPackage(MyPackage);
end
end;
Code in the pbl:
procedure MakeError;
var
P : TControl;
begin
P := nil;
P.Name := 'Hi';
end;
exports
MakeError;
----
any ideas ? I'm using delphi BDS 2006
Regards
Trond Morken
admin
07-Sep-2006, 09:19 AM
Hi,
Trond Morken wrote:
> Hello, I'm loading packages dynamically in my program, but I'm not able to
> get correct stack info when the error occurs in a package. I have enabled
> the eurekalog in the pbl and in the application. The IDE catches the
> exception and goes to the correct line in the bpl, but Eurekalog is not able
> to locate this.
>
> If I build my application with runtime packages everyting works just fine,
> but that is not an option for me.
>
> [...]
>
> Regards
> Trond Morken
Can you send to me a full functionally source project (package included) able to
reproduce this problem, please?
--
Best regards...
Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!
admin
08-Sep-2006, 09:29 AM
Hi,
Trond Morken wrote:
> Hello, I'm loading packages dynamically in my program, but I'm not able to
> get correct stack info when the error occurs in a package. I have enabled
> the eurekalog in the pbl and in the application. The IDE catches the
> exception and goes to the correct line in the bpl, but Eurekalog is not able
> to locate this.
>
> If I build my application with runtime packages everyting works just fine,
> but that is not an option for me.
>
> [...]
>
> Regards
> Trond Morken
I have find the cause.
This appends because the
finally
UnloadPackage(MyPackage);
end
block are executed before that EurekaLog can handle the exception, so if the
Package is Unloaded EurekaLog cannot debug it.
--
Best regards...
Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!
Trond Morken
08-Sep-2006, 10:23 AM
Ok, so the solution to this is
try
try
@MyProc:=GetProcAddress(MyPackage, 'MakeError');
if Assigned(MyProc) then
MyProc;
except
StandardEurekaNotify(ExceptObject, ExceptAddr);
end;
finally
UnloadPackage(MyPackage);
end;
"admin" <support@eurekalog.com> wrote in message
news:edrd4o$1u2$1@plesk.eurekalog.com...
> Hi,
>
> Trond Morken wrote:
>> Hello, I'm loading packages dynamically in my program, but I'm not able
>> to get correct stack info when the error occurs in a package. I have
>> enabled the eurekalog in the pbl and in the application. The IDE catches
>> the exception and goes to the correct line in the bpl, but Eurekalog is
>> not able to locate this.
>>
>> If I build my application with runtime packages everyting works just
>> fine, but that is not an option for me.
>>
>> [...]
>>
>> Regards
>> Trond Morken
>
> I have find the cause.
> This appends because the
>
>
>
> finally
> UnloadPackage(MyPackage);
> end
>
>
>
> block are executed before that EurekaLog can handle the exception, so if
> the Package is Unloaded EurekaLog cannot debug it.
>
> --
> Best regards...
>
> Fabio Dell'Aria.
> ----------------
> http://www.eurekalog.com
> Catch every BUG, every time!
admin
08-Sep-2006, 10:38 AM
Hi,
Trond Morken wrote:
> Ok, so the solution to this is
>
>
> try
> try
> @MyProc:=GetProcAddress(MyPackage, 'MakeError');
>
> if Assigned(MyProc) then
> MyProc;
> except
> StandardEurekaNotify(ExceptObject, ExceptAddr);
> end;
> finally
> UnloadPackage(MyPackage);
> end;
>
Yes it's a good solution! ;)
--
Best regards...
Fabio Dell'Aria.
----------------
http://www.eurekalog.com
Catch every BUG, every time!
vBulletin® v3.8.2, Copyright ©2000-2013, Jelsoft Enterprises Ltd.