backtrace.c File Reference

#include "config.h"
#include <string.h>
#include <stdlib.h>
#include <isc/backtrace.h>
#include <isc/result.h>
#include <isc/util.h>

Go to the source code of this file.

Defines

#define BACKTRACE_DISABLED

Functions

isc_result_t isc_backtrace_gettrace (void **addrs, int maxaddrs, int *nframes)
 Get a back trace of the running process above this function itself. On success, addrs[i] will store the address of the call point of the i-th stack frame (addrs[0] is the caller of this function). *nframes will store the total number of frames.
isc_result_t isc_backtrace_getsymbolfromindex (int idx, const void **addrp, const char **symbolp)
 Returns the content of the internal symbol table of the given index. On success, *addrsp and *symbolp point to the address and the symbol of the 'index'th entry of the table, respectively. If 'index' is not in the range of the symbol table, ISC_R_RANGE will be returned.
static int symtbl_compare (const void *addr, const void *entryarg)
isc_result_t isc_backtrace_getsymbol (const void *addr, const char **symbolp, unsigned long *offsetp)
 Searches the internal symbol table for the symbol that most matches the given 'addr'. On success, '*symbolp' will point to the name of function to which the address 'addr' belong, and '*offsetp' will store the offset from the function's entry address to 'addr'.


Detailed Description

Definition in file backtrace.c.


Define Documentation

#define BACKTRACE_DISABLED

Definition at line 61 of file backtrace.c.


Function Documentation

isc_result_t isc_backtrace_gettrace ( void **  addrs,
int  maxaddrs,
int *  nframes 
)

Get a back trace of the running process above this function itself. On success, addrs[i] will store the address of the call point of the i-th stack frame (addrs[0] is the caller of this function). *nframes will store the total number of frames.

Requires (note that these are not ensured by assertion checks, see above):

Returns:

Definition at line 211 of file backtrace.c.

References ISC_R_FAILURE, ISC_R_NOTIMPLEMENTED, and UNUSED.

Referenced by assertion_failed(), and default_callback().

isc_result_t isc_backtrace_getsymbolfromindex ( int  index,
const void **  addrp,
const char **  symbolp 
)

Returns the content of the internal symbol table of the given index. On success, *addrsp and *symbolp point to the address and the symbol of the 'index'th entry of the table, respectively. If 'index' is not in the range of the symbol table, ISC_R_RANGE will be returned.

Requires

Returns:

Definition at line 223 of file backtrace.c.

References isc_backtrace_symmap::addr, isc__backtrace_nsymbols, isc__backtrace_symtable, ISC_R_RANGE, ISC_R_SUCCESS, REQUIRE, and isc_backtrace_symmap::symbol.

Referenced by dump_symboltable().

static int symtbl_compare ( const void *  addr,
const void *  entryarg 
) [static]

Definition at line 238 of file backtrace.c.

References isc_backtrace_symmap::addr, isc__backtrace_nsymbols, and isc__backtrace_symtable.

Referenced by isc_backtrace_getsymbol().

isc_result_t isc_backtrace_getsymbol ( const void *  addr,
const char **  symbolp,
unsigned long *  offsetp 
)

Searches the internal symbol table for the symbol that most matches the given 'addr'. On success, '*symbolp' will point to the name of function to which the address 'addr' belong, and '*offsetp' will store the offset from the function's entry address to 'addr'.

Requires (note that these are not ensured by assertion checks, see above):

Returns:

Definition at line 264 of file backtrace.c.

References isc_backtrace_symmap::addr, isc__backtrace_nsymbols, isc__backtrace_symtable, ISC_R_FAILURE, ISC_R_NOTFOUND, ISC_R_SUCCESS, isc_backtrace_symmap::symbol, and symtbl_compare().

Referenced by assertion_failed(), and default_callback().


Generated on Tue Apr 28 17:41:14 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha