🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.delphi.language.basm
3 messages
3 total messages Started by Anderson Thu, 05 Jun 2008 13:11
Log exit
#470
Author: Anderson
Date: Thu, 05 Jun 2008 13:11
12 lines
1410 bytes
Hi guys, I'm building an application wide log system, I was thinking on 
insert code for do this enclosed on the begin and end of every method, 
function or procedure. The main problem is the "exit" instruction, I can 
write code to manage abnormal exits from a procedure by an exception, but I 
can't do this for an "exit" that works like an inconditional jump to the end 
of the procedure.

So my question is, there is a way to know at runtime the procedure address 
and it's length? If there is I could write my own "exit" procedure that 
makes the jump.

Thanks; 
Re: Log exit
#474
Author: Anderson
Date: Thu, 05 Jun 2008 17:01
17 lines
1741 bytes
Sorry, I thought about just a little and I got it. Thanks.

"Anderson" <assoffa@hotmail.com> escreveu na mensagem 
news:4847e5ea@newsgroups.borland.com...
> Hi guys, I'm building an application wide log system, I was thinking on 
> insert code for do this enclosed on the begin and end of every method, 
> function or procedure. The main problem is the "exit" instruction, I can 
> write code to manage abnormal exits from a procedure by an exception, but 
> I can't do this for an "exit" that works like an inconditional jump to the 
> end of the procedure.
>
> So my question is, there is a way to know at runtime the procedure address 
> and it's length? If there is I could write my own "exit" procedure that 
> makes the jump.
>
> Thanks;
> 
Re: Log exit
#475
Author: Per Larsen
Date: Thu, 05 Jun 2008 17:07
29 lines
1863 bytes
From your description, I don't quite understand exactly what it is you want 
to accomplish and how you attempt to accomplish it (the exit aside), but if 
you do something like this:

begin
  try
    if SomeCondition
      .. some logic here
      exit;
    end else
       ... some logic here
   finally
      Log(...
   end;
end;

The Log statement _will_ get executed when the exit is hit, FWIW.

> So my question is, there is a way to know at runtime the procedure address 
> and it's length? If there is I could write my own "exit" procedure that 
> makes the jump.

Not really - other than decoding the code bytes - but simply jumping to the 
end wouldn't work anyway when exception frames are present since they must 
be explicitly unwound by the exit logic. Single-step from the exit statement 
in an example like mine above within the CPU window to see what I'm 
referring to.

- Per
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads