| 1 |
debug: runtime debugging support |
| 2 |
|
| 3 |
The debug module implements various runtime debugging services. It is enabled by |
| 4 |
default when you build programs in debug mode (you can disable this by building |
| 5 |
in release mode with the -R flag to hare(1)). It provides detailed backtraces in |
| 6 |
various error conditions, including: |
| 7 |
|
| 8 |
- Assertion failures |
| 9 |
- Built-in assertions (e.g. for the "as" operator) |
| 10 |
- Segmentation faults |
| 11 |
- Arithmetic exceptions (e.g. divide by zero) |
| 12 |
- Bus errors |
| 13 |
- Stack overflows |
| 14 |
|
| 15 |
In order to accomplish this, the debug module does some logic on @init which |
| 16 |
rigs up [[rt::]] with debugging hooks and installs the relevant signal handlers |
| 17 |
globally. If you set your own signal handlers for terminating signals (e.g. |
| 18 |
SIGFPE) that the debug module handles, they will override the debug hooks. |
| 19 |
|
| 20 |
This module may also be used explicitly to inspect details of the running |
| 21 |
program -- for instance, you can trace the call stack with [[walk]]. |