[fpc-pascal] Get all caller adresses of a procedure/function

Martin lazarus at mfriebe.de
Mon Aug 6 18:43:04 CEST 2012


On 06/08/2012 15:26, Rainer Stratmann wrote:
> procedure p1;
> begin
>   ...
> end;
>
>
>
> How to get all caller adresses of p1 in a program before p1 is executed?
>
> For example p1 is called from 20 different places in a program.
> Then I need the 20 caller adresses.
>

At run time, or design time?

at design time, there is find in files, codetools "find references", or 
add "deprecated" and let compile and see the warnings.

At runtime, you can get the address, and if you have debug info, also 
the unit and line.
Run in debugger and use the stack window.
Or use (in your source code , needs console , or logfile) dumpstack();



More information about the fpc-pascal mailing list