xref: /plan9/sys/man/2/getcallerpc (revision ec59a3ddbfceee0efe34584c2c9981a5e5ff1ec4)
GETCALLERPC 2
NAME
getcallerpc - fetch return PC of current function
SYNOPSIS

#include <u.h>

#include <libc.h>

uintptr 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
.EX void printpc(int arg) { print("Called from %p\en", getcallerpc(&arg)); } void main(int argc, char *argv[]) { printpc(0); printpc(0); printpc(0); }
SOURCE
/sys/src/libc/$objtype/getcallerpc.[cs]
BUGS
The firstarg parameter should not be necessary.