The latest development version of this page may be more current than this released 3.7.0 version.

Symbol Table (Symtab)

The Symtab module, when enabled, will generate full symbol table during the Zephyr linking stage that keep tracks of the information about the functions’ name and address, for advanced application with a lot of functions, this is expected to consume a sizable amount of ROM.

Currently, this is being used to look up the function names during a stack trace in supported architectures.

Usage

Application can gain access to the symbol table data structure by including the symtab.h header file and call symtab_get(). For now, we only provide symtab_find_symbol_name() function to look-up the symbol name and offset of an address. More advanced functionalities and be achieved by directly accessing the members of the data structure.

Configuration

Configure this module using the following options.

API documentation

group symtab_apis

Functions

const struct symtab_info *const symtab_get(void)

Get the pointer to the symbol table.

Returns:

Pointer to the symbol table.

const char *const symtab_find_symbol_name(uintptr_t addr, uint32_t *offset)

Find the symbol name with a binary search.

Parameters:
  • addr[in] Address of the symbol to find

  • offset[out] Offset of the symbol from the nearest symbol. If the symbol can’t be found, this will be 0.

Returns:

Name of the nearest symbol if found, otherwise “?” is returned.

struct symtab_info
#include <symtab.h>