'\" t
.\" Title: libtraceevent
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 01/14/2024
.\" Manual: libtraceevent Manual
.\" Source: libtraceevent 1.8.2
.\" Language: English
.\"
.TH "LIBTRACEEVENT" "3" "01/14/2024" "libtraceevent 1\&.8\&.2" "libtraceevent Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
tep_find_function, tep_find_function_address, tep_find_function_info \- Find function name / start address\&.
.SH "SYNOPSIS"
.sp
.nf
\fB#include \fR
const char *\fBtep_find_function\fR(struct tep_handle *\fItep\fR, unsigned long long \fIaddr\fR);
unsigned long long \fBtep_find_function_address\fR(struct tep_handle *\fItep\fR, unsigned long long \fIaddr\fR);
int \fBtep_find_function_info\fR(struct tep_handle *\fItep\fR, unsigned long long \fIaddr\fR, const char **\fIname\fR,
unsigned long long *\fIstart\fR, unsigned long *\fIsize\fR);
.fi
.SH "DESCRIPTION"
.sp
These functions can be used to find function name and start address, by given address\&. The given address does not have to be exact, it will select the function that would contain it\&.
.sp
The \fBtep_find_function()\fR function returns the function name, which contains the given address \fIaddr\fR\&. The \fItep\fR argument is the trace event parser context\&.
.sp
The \fBtep_find_function_address()\fR function returns the function start address, by given address \fIaddr\fR\&. The \fIaddr\fR does not have to be exact, it will select the function that would contain it\&. The \fItep\fR argument is the trace event parser context\&.
.sp
The \fBtep_find_function_info()\fR function retrieves the \fIname\fR, starting address (\fIstart\fR), and the function text \fIsize\fR of the function at \fIaddress\fR, if it is found\&. Note, if the \fItep\fR handle has a function resolver (used by perf), then \fIsize\fR is set to zero\&.
.SH "RETURN VALUE"
.sp
The \fBtep_find_function()\fR function returns the function name, or NULL in case it cannot be found\&.
.sp
The \fBtep_find_function_address()\fR function returns the function start address, or 0 in case it cannot be found\&.
.sp
The \fBtep_find_function_info()\fR function returns 1 if a function is found for the given address, or 0 if it is not\&.
.SH "EXAMPLE"
.sp
.if n \{\
.RS 4
.\}
.nf
#include
\&.\&.\&.
struct tep_handle *tep = tep_alloc();
\&.\&.\&.
void show_function_name(unsigned long long addr)
{
const char *fname = tep_find_function(tep, addr);
if (fname)
printf("Found function %s at 0x%0llx\en", fname, addr);
else
printf("No function found at 0x%0llx\en", addr);
}
void show_function_start_addr(unsigned long long addr)
{
const char *fname = tep_find_function(tep, addr);
unsigned long long fstart;
if (!fname) {
printf("No function found at 0x%0llx\en", addr);
return;
}
fstart = tep_find_function_address(tep, addr);
printf("Function %s at 0x%llx starts at 0x%0llx\en",
fname, addr, fstart);
}
void show_function_info(unsigned long long addr)
{
const char *fname;
unsigned long long fstart;
unsigned long size;
ret = tep_find_function_info(tep, addr, &fname, &fstart, &size);
if (!ret) {
printf("No function found at 0x%0lx\en", addr);
return;
}
printf("Function %s at 0x%lx starts at 0x%0lx and is %ld in size\en",
fname, addr, fstart, size);
}
\&.\&.\&.
.fi
.if n \{\
.RE
.\}
.SH "FILES"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBevent\-parse\&.h\fR
Header file to include in order to have access to the library APIs\&.
\fB\-ltraceevent\fR
Linker switch to add when building a program that uses the library\&.
.fi
.if n \{\
.RE
.\}
.SH "SEE ALSO"
.sp
\fBlibtraceevent\fR(3), \fBtrace\-cmd\fR(1)
.SH "AUTHOR"
.sp
.if n \{\
.RS 4
.\}
.nf
\fBSteven Rostedt\fR <\m[blue]\fBrostedt@goodmis\&.org\fR\m[]\&\s-2\u[1]\d\s+2>, author of \fBlibtraceevent\fR\&.
\fBTzvetomir Stoyanov\fR <\m[blue]\fBtz\&.stoyanov@gmail\&.com\fR\m[]\&\s-2\u[2]\d\s+2>, author of this man page\&.
.fi
.if n \{\
.RE
.\}
.SH "REPORTING BUGS"
.sp
Report bugs to <\m[blue]\fBlinux\-trace\-devel@vger\&.kernel\&.org\fR\m[]\&\s-2\u[3]\d\s+2>
.SH "LICENSE"
.sp
libtraceevent is Free Software licensed under the GNU LGPL 2\&.1
.SH "RESOURCES"
.sp
\m[blue]\fBhttps://git\&.kernel\&.org/pub/scm/libs/libtrace/libtraceevent\&.git/\fR\m[]
.SH "NOTES"
.IP " 1." 4
rostedt@goodmis.org
.RS 4
\%mailto:rostedt@goodmis.org
.RE
.IP " 2." 4
tz.stoyanov@gmail.com
.RS 4
\%mailto:tz.stoyanov@gmail.com
.RE
.IP " 3." 4
linux-trace-devel@vger.kernel.org
.RS 4
\%mailto:linux-trace-devel@vger.kernel.org
.RE