CallStack

class CallStack

Call stack object.

The allocation of the stack must be static to prevent problems during out-of-memory scenario. That’s why we should not be using std::vector or similar.

Public Types

using String = std::basic_string<char, std::char_traits<char>, MemoryArenaAllocator<char>>

String that wll be allocated in our dedicated memory arena.

Public Functions

CallStack()

Build the call stack object with defined size.

void dump()

Dump the call stack objects to standard error.

void add(Msg *msg)

Add a message to a stack.

void remove(Msg *msg)

Remove a message from a stack.

std::size_t get_size() const

Get size of the call stack.

Msg *at(std::size_t idx) const

Get item at position idx

Public Static Functions

static void initialize()

Initialize the call stack capability.

This hooks to SIGABRT and SIGSEGV signals

struct Msg

Holds data for one call stack object.

Public Functions

Msg(const char *location, int line_no, const char *func)

Construct call stack object.

Parameters:
  • location – File name

  • line_no – Line number

  • funcFunction name

Public Members

String msg

Message.

String location

Location.

int line_no

Line number.