#include <SealDebug.h>
Static Public Member Functions | |
static IOFD | stacktraceFd (IOFD fd=IOFD_INVALID) |
static void | stacktrace (IOFD fd=IOFD_INVALID) |
static void | coredump (int sig,...) |
static void | stacktraceLine (IOFD fd, unsigned long addr) |
static void | setStackTraceAddr2Line (const char *path) |
Utilities for debugging support.
void Athena::DebugAids::coredump | ( | int | sig, | |
... | ||||
) | [static] |
Drop a core dump and continue.
Creates a core file for the current program state and continues execution. sig should be the number of the signal from which the program should appear to have died; this should a fatal signal that does cause a core file to be created (or SIGUSR1
).
This works by forking the process and then killing the child with the given signal; the signal is automatically unblocked in the child to make sure the sure the signal is delivered. Thus the function returns only once, in the parent process.
This function can be safely installed directly as a signal handler. Signal::handleFatal() will do so for SIGUSR1
with suitable options.
Note that this function does not change core dump resource limits, not even for the forked child process. If core files are disabled through resource limits, no core file will be created despite your explicit request to create one.
This concept was taken from DDD, the Data Display Debugger.
void Athena::DebugAids::stacktrace | ( | IOFD | fd = IOFD_INVALID |
) | [static] |
Produce a stack trace.
Prints the current stack trace to file descriptor fd or if the default invalid descriptor, the currently registered stack trace descriptor as registered with stacktraceFd(). Avoids unnecessary memory allocation so it should be safe to call this function even in dire situations. On some systems the implementation always outputs to the standard error and has no means for redirection. On these systems an attempt is made to redirect standard error momentarily elsewhere and then redirect standard error to the desired file descriptor, invoke the output, and redirect standard error back to its original location. If the redirection fails or the system has no stack tracing support, no stack trace is produced.
Set and return the file descriptor for stack trace output.
If fd is the default invalid descriptor value, returns the current value without changing the setting. This value is only effective for stacktrace(), but can be overridden by the argument given to that function.
void Athena::DebugAids::stacktraceLine | ( | IOFD | fd, | |
unsigned long | addr | |||
) | [static] |
Write out stack trace line to FD. IP is the instruction pointer. (sss)