![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Signals general handling with stack printing. More...
#include <signal.h>#include <stdio.h>#include <assert.h>#include <stdlib.h>#include <stdbool.h>#include <stdint.h>#include <errno.h>#include <string.h>#include "nilorea/n_log.h"#include "nilorea/n_signals.h"#include "nilorea/n_str.h"#include <err.h>#include <execinfo.h>
Include dependency graph for n_signals.c:Go to the source code of this file.
Macros | |
| #define | LOGFPRT(...) fprintf(stderr, "Error: " __VA_ARGS__) |
| internal: output to stderr | |
| #define | LOGNLOG(...) n_log(LOG_ERR, __VA_ARGS__) |
| internal: output to syslog | |
| #define | LOGSIG LOGNLOG |
| internal: output to syslog | |
Functions | |
| int | addr2line (char const *const program_name, void const *const addr) |
| Resolve symbol name and source location given the path to the executable and an address. | |
| void | posix_print_stack_trace () |
| print current stack | |
| void | posix_signal_handler (int sig, siginfo_t *siginfo, void *context) |
| decode a signal and call stack print | |
| void | set_signal_handler (const char *progname) |
| Install a signal handler for progname. | |
Variables | |
| static const char * | __n_stack_traced_progam_name |
| name of program to debug (addr2line & co) | |
| static void * | stack_traces [32] |
| static frame list | |
Signals general handling with stack printing.
Definition in file n_signals.c.
| #define LOGFPRT | ( | ... | ) | fprintf(stderr, "Error: " __VA_ARGS__) |
internal: output to stderr
Definition at line 24 of file n_signals.c.
internal: output to syslog
Definition at line 27 of file n_signals.c.
| #define LOGSIG LOGNLOG |
internal: output to syslog
Definition at line 30 of file n_signals.c.
| int addr2line | ( | char const *const | program_name, |
| void const *const | addr | ||
| ) |
Resolve symbol name and source location given the path to the executable and an address.
| program_name | target filename |
| addr | address to peek |
Definition at line 86 of file n_signals.c.
References addr, N_STR::data, free_nstr, LOGSIG, and n_popen().
Referenced by posix_print_stack_trace().
Here is the call graph for this function:
Here is the caller graph for this function:| void posix_print_stack_trace | ( | ) |
print current stack
Definition at line 251 of file n_signals.c.
References __n_stack_traced_progam_name, addr2line(), LOGSIG, MAX_STACK_FRAMES, and stack_traces.
Referenced by posix_signal_handler().
Here is the call graph for this function:
Here is the caller graph for this function:| void posix_signal_handler | ( | int | sig, |
| siginfo_t * | siginfo, | ||
| void * | context | ||
| ) |
decode a signal and call stack print
| sig | signal to decode |
| siginfo | details of the signal |
| context | the context to unroll |
Definition at line 280 of file n_signals.c.
References LOGSIG, and posix_print_stack_trace().
Referenced by set_signal_handler().
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
name of program to debug (addr2line & co)
Definition at line 33 of file n_signals.c.
Referenced by posix_print_stack_trace(), and set_signal_handler().
|
static |
static frame list
Definition at line 246 of file n_signals.c.
Referenced by posix_print_stack_trace().