My Project
programmer's documentation
Functions
bft_backtrace.c File Reference
#include "cs_defs.h"
#include <assert.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "bft_backtrace.h"
Include dependency graph for bft_backtrace.c:

Functions

bft_backtrace_tbft_backtrace_create (void)
 Build a backtrace description structure. More...
 
bft_backtrace_tbft_backtrace_destroy (bft_backtrace_t *bt)
 Free a backtrace description structure. More...
 
void bft_backtrace_demangle (bft_backtrace_t *bt)
 Demangle a backtrace description structure (for C++). More...
 
int bft_backtrace_size (const bft_backtrace_t *bt)
 Return the depth of a backtrace. More...
 
const char * bft_backtrace_file (bft_backtrace_t *bt, int depth)
 Return file name associated with a backtrace at a given depth. More...
 
const char * bft_backtrace_function (bft_backtrace_t *bt, int depth)
 Return function name associated with a backtrace at a given depth. More...
 
const char * bft_backtrace_address (bft_backtrace_t *bt, int depth)
 Return address associated with a backtrace at a given depth. More...
 
void bft_backtrace_print (int start_depth)
 Print a backtrace. More...
 
bft_backtrace_print_tbft_backtrace_print_get (void)
 Returns backtrace print function. More...
 
void bft_backtrace_print_set (bft_backtrace_print_t *const fct)
 Sets a backtrace print function. More...
 

Function Documentation

◆ bft_backtrace_address()

const char* bft_backtrace_address ( bft_backtrace_t bt,
int  depth 
)

Return address associated with a backtrace at a given depth.

Parameters
[in]btpointer to backtrace description structure.
[in]depthindex in backtrace structure (< bft_backtrace_size(bt)).
Returns
address at the given depth, or NULL.

◆ bft_backtrace_create()

bft_backtrace_t* bft_backtrace_create ( void  )

Build a backtrace description structure.

Returns
pointer to bft_backtrace_t backtrace descriptor (NULL in case of error, or if backtracing is unavailable on this architecture).

◆ bft_backtrace_demangle()

void bft_backtrace_demangle ( bft_backtrace_t bt)

Demangle a backtrace description structure (for C++).

Parameters
[in,out]btpointer to backtrace description structure.

◆ bft_backtrace_destroy()

bft_backtrace_t* bft_backtrace_destroy ( bft_backtrace_t bt)

Free a backtrace description structure.

Parameters
[in,out]btpointer to backtrace description structure.
Returns
NULL pointer.

◆ bft_backtrace_file()

const char* bft_backtrace_file ( bft_backtrace_t bt,
int  depth 
)

Return file name associated with a backtrace at a given depth.

Parameters
[in]btpointer to backtrace description structure.
[in]depthindex in backtrace structure (< bft_backtrace_size(bt)).
Returns
file name at the given depth, or NULL.

◆ bft_backtrace_function()

const char* bft_backtrace_function ( bft_backtrace_t bt,
int  depth 
)

Return function name associated with a backtrace at a given depth.

Parameters
[in]btpointer to backtrace description structure.
[in]depthindex in backtrace structure (< bft_backtrace_size(bt)).
Returns
function name at the given depth, or NULL.

◆ bft_backtrace_print()

void bft_backtrace_print ( int  start_depth)

Print a backtrace.

Parameters
[in]start_depthdepth of backtrace at which to start printing (0 for all, including backtrace print function)

◆ bft_backtrace_print_get()

bft_backtrace_print_t* bft_backtrace_print_get ( void  )

Returns backtrace print function.

Returns
pointer to the backtrace print function.

◆ bft_backtrace_print_set()

void bft_backtrace_print_set ( bft_backtrace_print_t *const  fct)

Sets a backtrace print function.

Parameters
[in]fctpointer to a bft_backtrace_print_t type function.

◆ bft_backtrace_size()

int bft_backtrace_size ( const bft_backtrace_t bt)

Return the depth of a backtrace.

Parameters
[in]btpointer to backtrace description structure.
Returns
backtrace depth.