| GETCALLERPC(3) | GETCALLERPC(3)
| NAME
| getcallerpc – fetch return PC of current function
SYNOPSIS
| `#include <u.h> #include <libc.h>
` `ulong getcallerpc(void *firstarg)`
DESCRIPTION
| Getcallerpc is a portable way to discover the PC to which the current function will return. Firstarg should be a pointer to the first argument to the function in question.
EXAMPLE
| `void printpc(ulong arg) {
| print("Called from %.8lux\n", getcallerpc(&arg));
} void main(int argc, char *argv[]) {
| printpc(0); printpc(0); printpc(0);
}`
SOURCE
| `/build/plan9port/pkg/plan9port/usr/local/plan9port/src/lib9/`
BUGS
| The firstarg parameter should not be necessary.