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

Rainer Stratmann RainerStratmann at t-online.de
Mon Aug 6 19:28:40 CEST 2012

Am Monday 06 August 2012 18:43:04 schrieb Martin:
> > 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 runtime.
I ment the (memory) caller adresses.

If p1 is executed I can get the caller adress with the rtl function:

get_caller_addr( get_frame );

But I want to scan the whole program before all p1's are called by the program 
to get all caller adresses of p1.

May be I write an own scan program to find all calling places which calls p1.

For that I need the memory adress where the program starts. And the length.

> 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();

I would like to do it without debug info.

More information about the fpc-pascal mailing list