Contiki-NG
|
Files | |
file | stack-check.c |
Implementation of the stack checker library. | |
Functions | |
void | stack_check_init (void) |
Initialize the stack area with a known pattern. | |
size_t | stack_check_get_usage (void) |
Calculate the maximal stack usage so far. | |
size_t | stack_check_get_reserved_size (void) |
Calculate the maximal permitted stack usage. | |
Basic support for stack guards and stack overflow detection. On startup, fills the area between the stack and the heap with a known pattern. During execution, the fill can be checked in order to find out the extent to which the stack has been used.
size_t stack_check_get_reserved_size | ( | void | ) |
Calculate the maximal permitted stack usage.
This function returns the number of bytes between the origin of the stack and the end of heap.
Definition at line 135 of file stack-check.c.
size_t stack_check_get_usage | ( | void | ) |
Calculate the maximal stack usage so far.
This function relies on the assumption that the stack memory that has been reserved by functions and local variables is actually overwritten with new contents. If the stack is just reserved, but not used, the function will fail to detect that usage. In addition, this function can warn if the stack memory range has been completely used, but it cannot detect and warn if stack overflow has already taken place. Returns SIZE_MAX when an error occurs.
Definition at line 104 of file stack-check.c.
References watchdog_periodic().
void stack_check_init | ( | void | ) |
Initialize the stack area with a known pattern.
This function initializes the memory between the stack and heap areas. The function should be called by the system during boot-up.
Definition at line 74 of file stack-check.c.
References process_start().