1 Star 0 Fork 0

lycclsltt / blazesym

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
BSD-3-Clause

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.

blazesym supports a variety of formats, such as DWARF, ELF, and Gsym (see below for an up-to-date list).

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!

As alluded to above, the library provides support for a variety of formats. For symbolization specifically, the following table lays out what features each format supports and whether blazesym can currently use this feature:

Format Feature Supported by format? Supported by blazesym?
ELF symbol size :heavy_check_mark: :heavy_check_mark:
source code location information :heavy_multiplication_x: :heavy_multiplication_x:
inlined function information :heavy_multiplication_x: :heavy_multiplication_x:
DWARF symbol size :heavy_check_mark: :heavy_check_mark:
source code location information :heavy_check_mark: :heavy_check_mark:
inlined function information :heavy_check_mark: :heavy_check_mark:
Gsym symbol size :heavy_check_mark: :heavy_check_mark:
source code location information :heavy_check_mark: :heavy_check_mark:
inlined function information :heavy_check_mark: :heavy_check_mark:
Ksym symbol size :heavy_multiplication_x: :heavy_multiplication_x:
source code location information :heavy_multiplication_x: :heavy_multiplication_x:
inlined function information :heavy_multiplication_x: :heavy_multiplication_x:

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

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.8"

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

Command-line

The library also comes with a command line interface for quick experimentation and debugging. You can run it directly from the repository, e.g.:

cargo run -p blazecli -- symbolize elf --path /lib64/libc.so.6 00000000000caee1

Please refer to its README as well as the help text for additional information and usage instructions.

BSD 3-Clause License Copyright (c) 2022, Kuifeng Lee All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

简介

暂无描述 展开 收起
Rust 等 3 种语言
BSD-3-Clause
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/lycclsltt/blazesym.git
git@gitee.com:lycclsltt/blazesym.git
lycclsltt
blazesym
blazesym
main

搜索帮助