On 07/08/2012 17:58, Rainer Stratmann wrote:
With the compiler keyword 'calleradresstable';

function s( str : pchar ) : pchar; calleradresstable;

Then the compiler makes a table of all calleradresses and also the amount of
s() in the program.
With the rtl function getcalleradresstable() then I get a pointer and the
amount of the array.

Interesting. I couldn't find any documentation on them, and fpc 2.6.0 does give an error.

But yes, with this added info, I can at least see what you try todo.

I can see 2 ways you get that address

procedure p (snip:string);
begin
    calleraddr := get_caller_addr(); //needs to be implemented
    ......
end
It exists already:
http://www.freepascal.org/docs-html/rtl/system/get_caller_addr.html
I knew there was something like it. But didnt have the name. So I gave a dummy name, and commented it.

But now, I have another question:

Despite calleradresstable not working for me, if it does for you, then what is the problem?

Sure get_caller_addr() returns the "return address" so it will differ. I do not 
know haw big the offset can be at max. But unless you include a disassembler, or 
debug-line info, you can not get exact details.
But likely you can assume a maximum offset (depending if calleradresstable is 
the asm or pascal statement address).


_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to