bt_sprnf_addrs()

Updated: April 19, 2023

Format the addresses from a backtrace

Note: The backtrace library is an unsupported feature, due to its fragility. For more information, see Backtraces in the QNX Neutrino technotes.

Synopsis:

#include <backtrace.h>

int bt_sprnf_addrs( bt_memmap_t *memmap,
                    bt_addr_t *addrs,
                    int addrslen,
                    char *fmt,
                    char *out,
                    size_t outlen,
                    char *separator );

Arguments:

memmap
NULL, or a pointer to memory-map information for the process you've collected backtracing for. Use bt_load_memmap() to initialize this variable.
addrs
An array of addresses that you want to format.
addrslen
The number of entries in the addrs array.
fmt
The format to use for each entry; see below.
out
A pointer to a buffer where the function can store the formatted output.
outlen
The length of the out, in bytes.
separator
NULL, or a pointer to a separator to write between the formatted addresses.

Library:

libbacktrace

Use the -l backtrace option to qcc to link against this library.

Description:

The bt_sprnf_addrs() function formats the addresses in the addrs using fmt as the format for each entry, and storing the formatted addresses in the out buffer. If separator isn't NULL, the function writes it in out between each formatted address.

The memmap is optional, but if specified, it allows access to more formatting styles. The format for each entry (fmt), is analogous to printf() formats:

Note: For the %l, %o, %f, and %I formats, memmap must not be NULL.

Returns:

The number of addresses from addr that could be completely formatted and written in out, or -1 if an error occurred (errno is set).

Errors:

EINVAL
One or more of the arguments is invalid.

Classification:

QNX Neutrino

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes