Subversion Repositories planix.SVN

Rev

Rev 22 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
.TH GETCALLERPC 2
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 uintptr 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(int arg)
21
{
22
	print("Called from %p\en", getcallerpc(&arg));
23
}
24
 
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 /sys/src/libc/$objtype/getcallerpc.[cs]
35
.SH BUGS
36
The 
37
.I firstarg
38
parameter should not be necessary.