Tracer
A C / C++ Linux / Windows Stack trace generator
Install / Use
/learn @mensinda/TracerREADME
Tracer
A C / C++ *nix / Windows Stack trace generator.
Full Doxygen documentation: https://mensinda.github.io/tracer/html/index.html
Build Status
| OS | Status |
|---------|--------|
| Linux | |
| Windows |
|
About the C wrapper
Tracer is written in C++11, but has an integrated C wrapper. All (supported) C++ class objects can be acquired with
tr_get<ClassName> functions and must be destroyed with tr_free<ClassName> functions.
All (supported) methodes can then be called with tr_<ClassName>__<functionName>.
The doxygen generated documentation can be found here: https://mensinda.github.io/tracer/html/tracer_8h.html
Usage
Simple setup
This will print a stack trace using the default Printer (FancyPrinter) and the default Config (TracerHandler::Config)
TracerHandler::getTracer()->defaultSetup();
or in C:
tr_defaultSetup();
This will generate the following output for the segFaultTest (in test/segFaultTest):

More advanced setup
With this setup it is possible to customize the output and signal handler.
auto *tHandler = TracerHandler::getTracer(); // Get the singleton
auto cfg = tHandler->getConfig(); // Get the current config
// Edit cfg
tHandler->setConfig(cfg); // Update the config
auto printer = PrinterContainer::fancy(); // Generates a printer
// Edit printer config
tHandler->setup(std::move(printer)); // Sets things up. Now the signal handler is setup
or using C:
tr_TracerHandler_t * trTH = tr_getTracerHandler(); // Get the handler
tr_TracerHandler_Config_t cfg = tr_TracerHandler__getConfig(trTH); // get the current config
// edit cfg
tr_TracerHandler__setConfig(trTH, cfg); // Update the config
tr_Printer_t *systemPrinter = tr_getPrinter__system(); // Generates a printer
// Edit printer config
tr_TracerHandler__setup(trTH, systemPrinter); // Sets things up. Now the signal handler is setup
// Do some cleanup
tr_freePrinter(systemPrinter);
tr_freeTracerHandler(trTH);
Status
Supported Operating Systems
- Linux
- Windows
It currently does not work on Mac OS because of ASLR. Pull requests are welcome :D
FreeBSD is currently not tested.
Backend status
| OS | Backend | Type | Status |
|---------|--------------------|------|--------------------|
| Windows | WIN32 | TB | :heavy_check_mark: |
| Linux | libunwind | T- | :heavy_check_mark: |
| | glibc bactrace | T- | :heavy_check_mark: |
| | libelf / elfutils | -D | :heavy_check_mark: |
| | libbfd / binutils | -D | :heavy_check_mark: |
| | addr2line fallback | -D | :warning: |
Types:
T-Stack trace generator-DDebug information extractorTDBoth
Status:
- :heavy_check_mark: works and testet
- :warning: works but not recommended
- :heavy_exclamation_mark: broken
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
