Coder Social home page Coder Social logo

blazesym's Introduction

pipeline coverage crates.io Docs rustc

blazesym

blazesym is a library that can be used to symbolize addresses. Address symbolization is a common problem in tracing contexts, for example, where users want to reason about functions by name, but low level components report only the "raw" addresses (e.g., in the form of stacktraces).

In addition to symbolization, blazesym also provides APIs for the reverse operation: looking up addresses from symbol names. That can be useful, for example, for configuring breakpoints or tracepoints.

The library aims to provide a "batteries-included" experience. That is to say, it tries to do the expected thing by default. When offering such convenience comes at the cost of performance, we aim to provide advanced APIs that allow for runtime configuration of the corresponding features.

The library is written in Rust and provides a first class C API. This crate adheres to Cargo's semantic versioning rules. At a minimum, it builds with the most recent Rust stable release minus five minor versions ("N - 5"). E.g., assuming the most recent Rust stable is 1.68, the crate is guaranteed to build with 1.63 and higher.

Status

blazesym is being actively worked on. Feel free to contribute with discussions, feature suggestions, or code contributions!

Here is rough roadmap of currently planned features (in no particular order):

  • Fully support handling of kernel addresses
    • currently normalization APIs, for example, only support user space addresses
  • Optimize normalization logic with more aggressive caching
  • Switch to using gimli for DWARF parsing
    • doing so will allow us to:
  • Support symbolization of addresses in APKs (relevant for Android) (libbpf#222 & libbpf#227)
  • Support ELF32 binaries (libbpf#53)
  • Support demangling of Rust & C++ symbol names (libbpf#50)
  • Support remote symbolization (libbpf#61)
  • Support advanced symbolization use cases involving debuginfod (libbpf#203)

Build & Use

blazesym requires a standard Rust toolchain and can be built using the Cargo project manager (e.g., cargo build).

Rust

Consumption from a Rust project should happen via Cargo.toml:

[dependencies]
blazesym = "0.2.0-alpha.2"

For a quick set of examples please refer to the examples/ folder. Please refer to the documentation for a comprehensive explanation of individual types and functions.

C

For C interoperability, the aforementioned build will produce libblazesym.a as well as libblazesym.so in the respective target folder (e.g., <project-root>/target/debug/).

In your C programs include blazesym.h (provided as part of the library) from your source code and then link against the static or shared library, respectively. When linking statically, you may also need to link:

-lrt -ldl -lpthread -lm

An example of usage of the C API is in available in libbpf-bootstrap: https://github.com/libbpf/libbpf-bootstrap/blob/master/examples/c/profile.c

This example periodically samples the running process of every processor in a system and prints their stack traces.

A detailed documentation of the C API is available as part of the Rust documentation or can be generated locally from the current repository snapshot using cargo doc (grouped under the c_api module).

blazesym's People

Contributors

d-e-s-o avatar mdrokz avatar anakryiko avatar benbenolson avatar dmitris avatar lgtm-migrator avatar thinkeryzu1 avatar anfernee avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.