src/bft/bft_backtrace.c File Reference

| programmer's documentation

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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_t * | bft_backtrace_create (void)
| Build a backtrace description structure. More...
bft_backtrace_t * | bft_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_t * | bft_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

const char* bft_backtrace_address | ( | bft_backtrace_t * | bt,
|  | int | depth
| ) |  |

Return address associated with a backtrace at a given depth.

Parameters

  [in] | bt | pointer to backtrace description structure.
  [in] | depth | index in backtrace structure (< bft_backtrace_size(bt)).

Returns
  address at the given depth, or NULL.

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).

void bft_backtrace_demangle | ( | bft_backtrace_t * | bt | ) |

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

Parameters

  [in,out] | bt | pointer to backtrace description structure.

bft_backtrace_t* bft_backtrace_destroy | ( | bft_backtrace_t * | bt | ) |

Free a backtrace description structure.

Parameters

  [in,out] | bt | pointer to backtrace description structure.

Returns
  NULL pointer.

const char* bft_backtrace_file | ( | bft_backtrace_t * | bt,
|  | int | depth
| ) |  |

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

Parameters

  [in] | bt | pointer to backtrace description structure.
  [in] | depth | index in backtrace structure (< bft_backtrace_size(bt)).

Returns
  file name at the given depth, or NULL.

const char* bft_backtrace_function | ( | bft_backtrace_t * | bt,
|  | int | depth
| ) |  |

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

Parameters

  [in] | bt | pointer to backtrace description structure.
  [in] | depth | index in backtrace structure (< bft_backtrace_size(bt)).

Returns
  function name at the given depth, or NULL.

void bft_backtrace_print | ( | int | start_depth | ) |

Print a backtrace.

Parameters

  [in] | start_depth | depth of backtrace at which to start printing (0 for all, including backtrace print function)

bft_backtrace_print_t* bft_backtrace_print_get | ( | void |  | ) |

Returns backtrace print function.

Returns
  pointer to the backtrace print function.

void bft_backtrace_print_set | ( | bft_backtrace_print_t *const | fct | ) |

Sets a backtrace print function.

Parameters

  [in] | fct | pointer to a bft_backtrace_print_t type function.

int bft_backtrace_size | ( | const bft_backtrace_t * | bt | ) |

Return the depth of a backtrace.

Parameters

  [in] | bt | pointer to backtrace description structure.

Returns
  backtrace depth.