Symbolic is a library written in Rust which is used at Sentry to implement symbolication of native stack traces, sourcemap handling for minified JavaScript and more. It consists of multiple largely independent crates which are bundled together into a C and Python library so it can be used independently of Rust.
Currently it provides the following functionality:
Symbolic comes as a python
Add symbolic
as a dependency to your Cargo.toml
. You will most likely want to activate some of
the features:
debuginfo
(default): Contains support for various object file formats and debugging
information. Currently, this comprises MachO and ELF (with DWARF debugging), PE and PDB, as well
as Breakpad symbols.demangle
: Demangling for Rust, C++, Swift and Objective C symbols. This feature requires a
C++11 compiler on the PATH.minidump
: Rust bindings for the Breakpad Minidump processor. Additionally, this includes
facilities to extract stack unwinding information (sometimes called CFI) from object files. This
feature requires a C++11 compiler on the PATH.proguard
: Processing of Proguard mapping files to look up mangled Java function paths.sourcemap
: Processing and expansion of JavaScript source maps, as well as lookups for
minified function names.symcache
: An optimized, platform-independent storage for common debugging information. This
allows blazing fast symbolication of instruction addresses to function names and file locations.serde
: Adds implementations for serde::{Deserialize, Serialize}
on most types.unreal
: Processing of Unreal Engine 4 crash reports.Symbolic is hosted on PyPI. It comes as a library with prebuilt wheels for linux and macOS. On other operating systems or when using as rust library, you need to build symbolic manually. It should be compatible with both Python 2 and Python 3.
The python library ships all of the above features in a flat module:
```python from symbolic import Archive
fat = Archive.open('/path/to/object') obj = fat.getobject(arch = 'x8664') print 'object debug id: {}' % obj.debug_id ```
Symbolic also offers C bindings, which allow for FFI into arbitrary languages. Have a look at the the Symbolic C-ABI readme for more information.
A lot of functionality exposed by this library come from independent Rust crates for better use:
Additionally we use the following C++ libraries to fill in gaps:
To build the Rust crate, we require the latest stable Rust, as well as a C++11 compiler. The
crate is split into a workspace with multiple features, so when running building or running tests
always make sure to pass the --all
and --all-features
flags.
```bash
cargo check --all --all-features
cargo test --all --all-features ```
We use rustfmt
and clippy
from the latest stable channel for code formatting and linting. To
make sure that these tools are set up correctly and running with the right configuration, use the
following make targets:
```bash
make format
make lint ```
Most likely, new functionality also needs to be added to the Python package. This first requires to expose new functions in the C ABI. For this, refer to the Symbolic C-ABI readme.
We highly recommend to develop and test the python package in a virtual environment. Once the ABI has been updated and tested, ensure the virtualenv is active and install the package, which builds the native library. There are two ways to install this:
```bash
pip install --editable ./py
SYMBOLIC_DEBUG=1 pip install --editable ./py ```
For testing, we use ubiquitous pytest
. Again, ensure that your virtualenv is active and the latest
version of the native library has been installed. Then, run:
```bash
pytest ./py/tests
make pytest ```
Symbolic is licensed under the MIT license. It uses some Apache2 licensed code from Apple for the Swift demangling.