Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A C / C++ Linux / Windows Stack trace generator

License

NotificationsYou must be signed in to change notification settings

mensinda/tracer

Repository files navigation

A C / C++ *nix / Windows Stack trace generator.

Full Doxygen documentation:https://mensinda.github.io/tracer/html/index.html

Build Status

OSStatus
LinuxBuild Status
WindowsBuild status

About the C wrapper

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

Usage

Simple setup

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):

Tracer Screenshot

More advanced setup

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);

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

OSBackendTypeStatus
WindowsWIN32TB✔️
LinuxlibunwindT-✔️
glibc bactraceT-✔️
libelf / elfutils-D✔️
libbfd / binutils-D✔️
addr2line fallback-D⚠️

Types:

  • T- Stack trace generator
  • -D Debug information extractor
  • TD Both

Status:

  • ✔️ works and testet
  • ⚠️ works but not recommended
  • ❗ broken

[8]ページ先頭

©2009-2025 Movatter.jp