Blob


1 .TH GETCALLERPC 3
2 .SH NAME
3 getcallerpc \- fetch return PC of current function
4 .SH SYNOPSIS
5 .br
6 .B #include <u.h>
7 .br
8 .B #include <libc.h>
9 .PP
10 .B ulong getcallerpc(void *firstarg)
11 .SH DESCRIPTION
12 .I Getcallerpc
13 is a portable way to discover the PC to which the current function will return.
14 .I Firstarg
15 should be a pointer to the first argument to the function in question.
16 .SH EXAMPLE
17 .IP
18 .EX
19 void
20 printpc(ulong arg)
21 {
22 print("Called from %.8lux\en", getcallerpc(&arg));
23 }
25 void
26 main(int argc, char *argv[])
27 {
28 printpc(0);
29 printpc(0);
30 printpc(0);
31 }
32 .EE
33 .SH SOURCE
34 .B \*9/src/lib9/
35 .SH BUGS
36 The
37 .I firstarg
38 parameter should not be necessary.