- Notifications
You must be signed in to change notification settings - Fork4
A C / C++ Linux / Windows Stack trace generator
License
mensinda/tracer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A C / C++ *nix / Windows Stack trace generator.
Full Doxygen documentation:https://mensinda.github.io/tracer/html/index.html
OS | Status |
---|---|
Linux | |
Windows |
Tracer is written in C++11, but has an integrated C wrapper. All (supported) C++ class objects can be acquired withtr_get<ClassName>
functions and must be destroyed withtr_free<ClassName>
functions.
All (supported) methodes can then be called withtr_<ClassName>__<functionName>
.
The doxygen generated documentation can be found here:https://mensinda.github.io/tracer/html/tracer_8h.html
This will print a stack trace using the default Printer (FancyPrinter) and the defaultConfig (TracerHandler::Config)
TracerHandler::getTracer()->defaultSetup();
or in C:
tr_defaultSetup();
This will generate the following output for the segFaultTest (in test/segFaultTest):
With this setup it is possible to customize the output and signal handler.
auto *tHandler = TracerHandler::getTracer();// Get the singletonauto cfg = tHandler->getConfig();// Get the current config// Edit cfgtHandler->setConfig(cfg);// Update the configauto printer = PrinterContainer::fancy();// Generates a printer// Edit printer configtHandler->setup(std::move(printer));// Sets things up. Now the signal handler is setup
or using C:
tr_TracerHandler_t*trTH=tr_getTracerHandler();// Get the handlertr_TracerHandler_Config_tcfg=tr_TracerHandler__getConfig(trTH);// get the current config// edit cfgtr_TracerHandler__setConfig(trTH,cfg);// Update the configtr_Printer_t*systemPrinter=tr_getPrinter__system();// Generates a printer// Edit printer configtr_TracerHandler__setup(trTH,systemPrinter);// Sets things up. Now the signal handler is setup// Do some cleanuptr_freePrinter(systemPrinter);tr_freeTracerHandler(trTH);
- Linux
- Windows
It currently does not work on Mac OS because of ASLR. Pull requests are welcome :D
FreeBSD is currently not tested.
OS | Backend | Type | Status |
---|---|---|---|
Windows | WIN32 | TB | ✔️ |
Linux | libunwind | T- | ✔️ |
glibc bactrace | T- | ✔️ | |
libelf / elfutils | -D | ✔️ | |
libbfd / binutils | -D | ✔️ | |
addr2line fallback | -D |
Types:
T-
Stack trace generator-D
Debug information extractorTD
Both
Status:
- ✔️ works and testet
⚠️ works but not recommended- ❗ broken