|
Packit |
86a02d |
'\"! tbl | nroff \-man
|
|
Packit |
86a02d |
'\" t macro stdmacro
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.de SAMPLE
|
|
Packit |
86a02d |
.br
|
|
Packit |
86a02d |
.RS 0
|
|
Packit |
86a02d |
.nf
|
|
Packit |
86a02d |
.nh
|
|
Packit |
86a02d |
..
|
|
Packit |
86a02d |
.de ESAMPLE
|
|
Packit |
86a02d |
.hy
|
|
Packit |
86a02d |
.fi
|
|
Packit |
86a02d |
.RE
|
|
Packit |
86a02d |
..
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TH DEBUGINFOD_FIND_* 3
|
|
Packit |
86a02d |
.SH NAME
|
|
Packit |
86a02d |
debuginfod_find_debuginfo \- request debuginfo from debuginfod
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH SYNOPSIS
|
|
Packit |
86a02d |
.nf
|
|
Packit |
86a02d |
.B #include <elfutils/debuginfod.h>
|
|
Packit |
86a02d |
.PP
|
|
Packit |
86a02d |
.BI "debuginfod_client *debuginfod_begin(void);"
|
|
Packit |
86a02d |
.BI "void debuginfod_end(debuginfod_client *" client ");"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.BI "int debuginfod_find_debuginfo(debuginfod_client *" client ","
|
|
Packit |
86a02d |
.BI " const unsigned char *" build_id ","
|
|
Packit |
86a02d |
.BI " int " build_id_len ","
|
|
Packit |
86a02d |
.BI " char ** " path ");"
|
|
Packit |
86a02d |
.BI "int debuginfod_find_executable(debuginfod_client *" client ","
|
|
Packit |
86a02d |
.BI " const unsigned char *" build_id ","
|
|
Packit |
86a02d |
.BI " int " build_id_len ","
|
|
Packit |
86a02d |
.BI " char ** " path ");"
|
|
Packit |
86a02d |
.BI "int debuginfod_find_source(debuginfod_client *" client ","
|
|
Packit |
86a02d |
.BI " const unsigned char *" build_id ","
|
|
Packit |
86a02d |
.BI " int " build_id_len ","
|
|
Packit |
86a02d |
.BI " const char *" filename ","
|
|
Packit |
86a02d |
.BI " char ** " path ");"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.BI "typedef int (*debuginfo_progressfn_t)(debuginfod_client *" client ","
|
|
Packit |
86a02d |
.BI " long a, long b);"
|
|
Packit |
86a02d |
.BI "void debuginfod_set_progressfn(debuginfod_client *" client ","
|
|
Packit |
86a02d |
.BI " debuginfo_progressfn_t " progressfn ");"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
Link with \fB-ldebuginfod\fP.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH DESCRIPTION
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.BR debuginfod_begin ()
|
|
Packit |
86a02d |
creates a \fBdebuginfod_client\fP connection handle that should be used
|
|
Packit |
86a02d |
with all other calls.
|
|
Packit |
86a02d |
.BR debuginfod_end ()
|
|
Packit |
86a02d |
should be called on the \fBclient\fP handle to release all state and
|
|
Packit |
86a02d |
storage when done.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.BR debuginfod_find_debuginfo (),
|
|
Packit |
86a02d |
.BR debuginfod_find_executable (),
|
|
Packit |
86a02d |
and
|
|
Packit |
86a02d |
.BR debuginfod_find_source ()
|
|
Packit |
86a02d |
query the debuginfod server URLs contained in
|
|
Packit |
86a02d |
.BR $DEBUGINFOD_URLS
|
|
Packit |
86a02d |
(see below) for the debuginfo, executable or source file with the
|
|
Packit |
86a02d |
given \fIbuild_id\fP. \fIbuild_id\fP should be a pointer to either
|
|
Packit |
86a02d |
a null-terminated, lowercase hex string or a binary blob. If
|
|
Packit |
86a02d |
\fIbuild_id\fP is given as a hex string, \fIbuild_id_len\fP should
|
|
Packit |
86a02d |
be 0. Otherwise \fIbuild_id_len\fP should be the number of bytes in
|
|
Packit |
86a02d |
the binary blob.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.BR debuginfod_find_source ()
|
|
Packit |
86a02d |
also requries a \fIfilename\fP in order to specify a particular
|
|
Packit |
86a02d |
source file. \fIfilename\fP should be an absolute path that includes
|
|
Packit |
86a02d |
the compilation directory of the CU associated with the source file.
|
|
Packit |
86a02d |
Relative path names commonly appear in the DWARF file's source directory,
|
|
Packit |
86a02d |
but these paths are relative to individual compilation unit AT_comp_dir
|
|
Packit |
86a02d |
paths, and yet an executable is made up of multiple CUs. Therefore, to
|
|
Packit |
86a02d |
disambiguate, debuginfod expects source queries to prefix relative path
|
|
Packit |
86a02d |
names with the CU compilation-directory, followed by a mandatory "/".
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
Note: the caller should not elide \fB../\fP or \fB/./\fP or extraneous
|
|
Packit |
86a02d |
\fB///\fP sorts of path components in the directory names, because if
|
|
Packit |
86a02d |
this is how those names appear in the DWARF files, that is what
|
|
Packit |
86a02d |
debuginfod needs to see too.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
If \fIpath\fP is not NULL and the query is successful, \fIpath\fP is set
|
|
Packit |
86a02d |
to the path of the file in the cache. The caller must \fBfree\fP() this value.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
The URLs in \fB$DEBUGINFOD_URLS\fP may be queried in parallel. As soon
|
|
Packit |
86a02d |
as a debuginfod server begins transferring the target file all of the
|
|
Packit |
86a02d |
connections to the other servers are closed.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
A \fBclient\fP handle should be used from only one thread at a time.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "RETURN VALUE"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
\fBdebuginfod_begin\fP returns the \fBdebuginfod_client\fP handle to
|
|
Packit |
86a02d |
use with all other calls. On error \fBNULL\fP will be returned and
|
|
Packit |
86a02d |
\fBerrno\fP will be set.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
If a find family function is successful, the resulting file is saved
|
|
Packit |
86a02d |
to the client cache and a file descriptor to that file is returned.
|
|
Packit |
86a02d |
The caller needs to \fBclose\fP() this descriptor. Otherwise, a
|
|
Packit |
86a02d |
negative error code is returned.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "PROGRESS CALLBACK"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
As the \fBdebuginfod_find_*\fP() functions may block for seconds or
|
|
Packit |
86a02d |
longer, a progress callback function is called periodically, if
|
|
Packit |
86a02d |
configured with
|
|
Packit |
86a02d |
.BR debuginfod_set_progressfn ().
|
|
Packit |
86a02d |
This function sets a new progress callback function (or NULL) for the
|
|
Packit |
86a02d |
client handle.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
The given callback function is called from the context of each thread
|
|
Packit |
86a02d |
that is invoking any of the other lookup functions. It is given two
|
|
Packit |
86a02d |
numeric parameters that, if thought of as a numerator \fIa\fP and
|
|
Packit |
86a02d |
denominator \fIb\fP, together represent a completion fraction
|
|
Packit |
86a02d |
\fIa/b\fP. The denominator may be zero initially, until a quantity
|
|
Packit |
86a02d |
such as an exact download size becomes known.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
The progress callback function is also the supported way to
|
|
Packit |
86a02d |
\fIinterrupt\fP the download operation. (The library does \fInot\fP
|
|
Packit |
86a02d |
modify or trigger signals.) The progress callback must return 0 to
|
|
Packit |
86a02d |
continue the work, or any other value to stop work as soon as
|
|
Packit |
86a02d |
possible. Consequently, the \fBdebuginfod_find_*\fP() function will
|
|
Packit |
86a02d |
likely return with an error, but might still succeed.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "CACHE"
|
|
Packit |
86a02d |
If the query is successful, the \fBdebuginfod_find_*\fP() functions save
|
|
Packit |
86a02d |
the target file to a local cache. The location of the cache is controlled
|
|
Packit |
86a02d |
by the \fB$DEBUGINFOD_CACHE_PATH\fP environment variable (see below).
|
|
Packit |
86a02d |
Cleaning of the cache is controlled by the \fIcache_clean_interval_s\fP
|
|
Packit |
86a02d |
and \fImax_unused_age_s\fP files, which are found in the
|
|
Packit |
86a02d |
\fB$DEBUGINFOD_CACHE_PATH\fP directory. \fIcache_clean_interval_s\fP controls
|
|
Packit |
86a02d |
how frequently the cache is traversed for cleaning and \fImax_unused_age_s\fP
|
|
Packit |
86a02d |
controls how long a file can go unused (fstat(2) atime) before it's
|
|
Packit |
86a02d |
removed from the cache during cleaning. These files should contain only an
|
|
Packit |
86a02d |
ASCII decimal integer representing the interval or max unused age in seconds.
|
|
Packit |
86a02d |
The default is one day and one week, respectively. Values of zero mean "immediately".
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "SECURITY"
|
|
Packit |
86a02d |
.BR debuginfod_find_debuginfo (),
|
|
Packit |
86a02d |
.BR debuginfod_find_executable (),
|
|
Packit |
86a02d |
and
|
|
Packit |
86a02d |
.BR debuginfod_find_source ()
|
|
Packit |
86a02d |
\fBdo not\fP include any particular security
|
|
Packit |
86a02d |
features. They trust that the binaries returned by the debuginfod(s)
|
|
Packit |
86a02d |
are accurate. Therefore, the list of servers should include only
|
|
Packit |
86a02d |
trustworthy ones. If accessed across HTTP rather than HTTPS, the
|
|
Packit |
86a02d |
network should be trustworthy. Passing user authentication information
|
|
Packit |
86a02d |
through the internal \fIlibcurl\fP library is not currently enabled, except
|
|
Packit |
86a02d |
for the basic plaintext \%\fIhttp[s]://userid:password@hostname/\fP style.
|
|
Packit |
86a02d |
(The debuginfod server does not perform authentication, but a front-end
|
|
Packit |
86a02d |
proxy server could.)
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "ENVIRONMENT VARIABLES"
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP 21
|
|
Packit |
86a02d |
.B DEBUGINFOD_URLS
|
|
Packit |
86a02d |
This environment variable contains a list of URL prefixes for trusted
|
|
Packit |
86a02d |
debuginfod instances. Alternate URL prefixes are separated by space.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP 21
|
|
Packit |
86a02d |
.B DEBUGINFOD_TIMEOUT
|
|
Packit |
86a02d |
This environment variable governs the timeout for each debuginfod HTTP
|
|
Packit |
86a02d |
connection. A server that fails to respond within this many seconds
|
|
Packit |
86a02d |
is skipped. The default is 5.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP 21
|
|
Packit |
86a02d |
.B DEBUGINFOD_CACHE_PATH
|
|
Packit |
86a02d |
This environment variable governs the location of the cache where
|
|
Packit |
86a02d |
downloaded files are kept. It is cleaned periodically as this
|
|
Packit |
86a02d |
program is reexecuted. The default is $HOME/.debuginfod_client_cache.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "ERRORS"
|
|
Packit |
86a02d |
The following list is not comprehensive. Error codes may also
|
|
Packit |
86a02d |
originate from calls to various C Library functions.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR EACCESS
|
|
Packit |
86a02d |
Denied access to resource located at the URL.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ECONNREFUSED
|
|
Packit |
86a02d |
Unable to connect to remote host.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ECONNRESET
|
|
Packit |
86a02d |
Unable to either send or recieve network data.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR EHOSTUNREACH
|
|
Packit |
86a02d |
Unable to resolve remote host.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR EINVAL
|
|
Packit |
86a02d |
One or more arguments are incorrectly formatted. \fIbuild_id\fP may
|
|
Packit |
86a02d |
be too long (greater than 256 characters), \fIfilename\fP may not
|
|
Packit |
86a02d |
be an absolute path or a debuginfod URL is malformed.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR EIO
|
|
Packit |
86a02d |
Unable to write data received from server to local file.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR EMLINK
|
|
Packit |
86a02d |
Too many HTTP redirects.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ENETUNREACH
|
|
Packit |
86a02d |
Unable to initialize network connection.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ENOENT
|
|
Packit |
86a02d |
Could not find the resource located at URL. Often this error code
|
|
Packit |
86a02d |
indicates that a debuginfod server was successfully contacted but
|
|
Packit |
86a02d |
the server could not find the target file.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ENOMEM
|
|
Packit |
86a02d |
System is unable to allocate resources.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ENOSYS
|
|
Packit |
86a02d |
\fB$DEBUGINFOD_URLS\fP is not defined.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.TP
|
|
Packit |
86a02d |
.BR ETIME
|
|
Packit |
86a02d |
Query failed due to timeout. \fB$DEBUGINFOD_TIMEOUT\fP controls
|
|
Packit |
86a02d |
the timeout duration. See debuginfod(8) for more information.
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "FILES"
|
|
Packit |
86a02d |
.LP
|
|
Packit |
86a02d |
.PD .1v
|
|
Packit |
86a02d |
.TP 20
|
|
Packit |
86a02d |
.B $HOME/.debuginfod_client_cache
|
|
Packit |
86a02d |
Default cache directory.
|
|
Packit |
86a02d |
.PD
|
|
Packit |
86a02d |
|
|
Packit |
86a02d |
.SH "SEE ALSO"
|
|
Packit |
86a02d |
.I "debuginfod(8)"
|