Giter Club home page Giter Club logo

symbolic's Introduction

Symbolic

Build Status codecov

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.

What's in the package

Symbolic provides the following functionality:

  • Symbolication based on custom cache files (symcache)
  • Symbol cache file generators from:
    • Mach, ELF and PE symbol tables
    • Mach, ELF and PE embedded DWARF data
    • PDB CodeView debug information
    • .NET Portable PDB
    • Breakpad symbol files
    • Unity IL2CPP
  • Demangling support
    • C++ (GCC, clang and MSVC)
    • Objective C / Objective C++
    • Rust
    • Swift
  • JavaScript sourcemap expansion
    • Basic token mapping
    • Heuristics to find original function names based on minified sources
    • Indexed sourcemap to sourcemap merging
  • Proguard function mappings
  • Generate Breakpad symbol files from Mach, ELF and PDBs
  • Convenient C and Python library
  • Processing of Unreal Engine 4 native crash reports
    • Extract and process minidumps
    • Expose logs and UE4 context information

Rust Usage

The Rust crates are published to Crates.io and documentation is available on docs.rs.

Python Usage

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:

from symbolic import Archive

fat = Archive.open('/path/to/object')
obj = fat.get_object(arch = 'x86_64')
print 'object debug id: {}' % obj.debug_id

C Bindings

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.

Source Crates

A lot of functionality exposed by this library come from independent Rust crates for better use:

Building and Development

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.

# Check whether the crate compiles
cargo check --all --all-features

# Run Rust tests
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:

# Format the entire codebase
make format

# Run clippy on the entire codebase
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:

# Install the release build, recommended:
pip install --editable ./py

# Install the debug build, faster installation but much slower runtime:
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:

# Run tests manually
pytest ./py/tests

# Creates a new virtualenv, installs the release build and runs tests:
make pytest

Examples

The repository contains a few examples that show how to use symbolic to work with debug files and minidumps. Most of these examples can also be used to extract information from such files or verify their integrity:

  • dump_cfi: Writes call frame information from an object file to standard out. The output format is Breakpad's STACK records.

  • dump_sources: Creates a source archive from all files referenced by an object file. This is now integrated into sentry-cli difutil bundle-sources.

  • minidump_stackwalk: Extracts stack traces from a minidump and symbolicates them. A path to a directory containing debug information files can be specified.

  • object_debug: Prints basic information about the contents of an object file.

  • sourcemapcache_debug: Converts a minified JavaScript file and its corresponding SourceMap into a sourcemapcache and resolves given line/col location.

  • symcache_debug: Converts an object file into a symcache and prints its contents. Optionally, this can be used to symbolicate a relative address.

  • unreal_engine_crash: Lists files contained within an Unreal Engine 4 crash archive.

To run these examples, use the run script. For example:

./run minidump_stackwalk mini.dmp /path/to/files

License

Symbolic is licensed under the MIT license. It uses some Apache2 licensed code from Apple for the Swift demangling.

symbolic's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

symbolic's Issues

[debuginfo] Lines are collapsed in DwarfUnit::resolve_lines

Identical consecutive lines are collapsed when resolving lines for a given range.
It's a pretty good idea to reduce data size but we lose information about addresses which belong to an inlinee.
For example, if we've:

0x1234: Line: 12, File: foo.c
0x1256: Line: 12, File: foo.c

we'll get only 0x1234: Line: 12, File: foo.c but we don't know anymore that 0x1256 belongs to the original inlinee.
There are 2 ways to fix that:

  • remove the collapsing;
  • add an option when getting functions iterator to not collapse consecutive lines.

Wdyt ?

Documentation on working with breakpad symbol files

I am trying to make sense of the unittests for python but I'm not too sure on how I should organize my breakpad symbols files so that I can get a backtrace out of them + a mini dump.

It sounds like getting a backtrace was separated from symbolication. Should we get a backtrace first, then look at the list of modules, and then find the symbols for those modules to finally do the symbolication ?

Any help would be appreciated. I am trying to get rid of this module (https://github.com/machinezone/stackwalker) in my project first, and then move to sentry proper once we can get a solution for code snippets for native crashes.

SymCache.buffer might reference released memory

symcache.py exposes the raw buffer as:

    @property
    def buffer(self):
        """Returns the underlying bytes of the cache."""
        buf = self._methodcall(lib.symbolic_symcache_get_bytes)
        size = self._methodcall(lib.symbolic_symcache_get_size)
        return ffi.buffer(buf, size)

There is no reference held to the symcache, so it might be freed, while the user still holds on to the buffer reference.

Expose PDB TypeFormatter

TypeFormatter is internal only at the moment, but it can be useful to use publically. Also, a better place may be in the pdb crate.

The challenge will be to expose the name from Function in a way that it can be "demangled" or formatted with custom parameters. At the moment, the name must be a string, so Name might have to be adapted to that.

Documentation for Python

Does the Python version of symbolic have any documentation? I couldn't find it on https://pypi.org/project/symbolic/ or in the source code. For instance I would like to know how to turn frame information like C++ binary name and address into a source file location with a line number. Is it possible to do?

Failed to install on ppc64le via pip

Tried to install 'symbolic' package on ppc64le , however getting below error :

$ pip install symbolic
+ pip install symbolic
Collecting symbolic
  Downloading symbolic-2.0.3.zip (5.6MB)
    100% |████████████████████████████████| 5.6MB 425kB/s
Requirement already satisfied: milksnake in /usr/local/lib/python2.7/site-packages (from symbolic)
Requirement already satisfied: cffi>=1.6.0 in /usr/local/lib/python2.7/site-packages (from milksnake->symbolic)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/site-packages (from cffi>=1.6.0->milksnake->symbolic)
Installing collected packages: symbolic
  Running setup.py install for symbolic ... error
    Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Uu7sOt/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-z_VLqx-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-ppc64le-2.7
    creating build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/_compat.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/exceptions.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/minidump.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/__init__.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/demangle.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/symcache.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/sourcemap.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/common.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/utils.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/proguard.py -> build/lib.linux-ppc64le-2.7/symbolic
    copying symbolic/debuginfo.py -> build/lib.linux-ppc64le-2.7/symbolic
        Updating registry `https://github.com/rust-lang/crates.io-index`
       Compiling stable_deref_trait v1.0.0
       Compiling plain v0.2.3
       Compiling if_chain v0.1.2
       Compiling unicode-normalization v0.1.5
       Compiling utf8-ranges v1.0.0
       Compiling percent-encoding v1.0.1
       Compiling num-traits v0.1.41
       Compiling fallible-iterator v0.1.4
       Compiling byteorder v1.2.1
       Compiling lazy_static v1.0.0
       Compiling unicode-xid v0.0.4
       Compiling scopeguard v0.3.3
       Compiling rayon-core v1.3.0
       Compiling cfg-if v0.1.2
       Compiling linked-hash-map v0.4.2
       Compiling quote v0.3.15
       Compiling rustc-demangle v0.1.5
       Compiling nodrop v0.1.12
       Compiling fnv v1.0.6
       Compiling serde v0.9.15
       Compiling lazy_static v0.2.11
       Compiling gcc v0.3.54
       Compiling matches v0.1.6
       Compiling void v1.0.2
       Compiling either v1.4.0
       Compiling dtoa v0.4.2
       Compiling rustc-serialize v0.3.24
       Compiling pdqsort v0.1.2
       Compiling serde v1.0.27
       Compiling sha1 v0.2.0
       Compiling regex-syntax v0.4.2
       Compiling semver-parser v0.7.0
       Compiling libc v0.2.36
       Compiling itoa v0.3.4
       Compiling owning_ref v0.3.3
       Compiling synom v0.11.3
       Compiling base64 v0.4.2
       Compiling log v0.4.1
       Compiling arrayvec v0.4.7
       Compiling lru-cache v0.1.1
       Compiling num-integer v0.1.35
       Compiling unicode-bidi v0.3.4
       Compiling unreachable v1.0.0
       Compiling coco v0.1.1
       Compiling dmsort v0.1.3
       Compiling rand v0.3.20
       Compiling memchr v2.0.1
       Compiling num_cpus v1.8.0
       Compiling memmap v0.5.2
       Compiling syn v0.11.11
       Compiling semver v0.6.0
       Compiling gimli v0.15.0
       Compiling log v0.3.9
       Compiling num-iter v0.1.34
       Compiling thread_local v0.3.5
       Compiling serde_json v0.9.10
       Compiling symbolic-demangle v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/demangle)
       Compiling aho-corasick v0.6.4
       Compiling idna v0.1.4
       Compiling uuid v0.5.1
       Compiling num-complex v0.1.41
       Compiling num-bigint v0.1.41
       Compiling rustc_version v0.2.1
       Compiling rayon v0.9.0
       Compiling url v1.6.0
       Compiling regex v0.2.5
       Compiling sourcemap v2.2.0
       Compiling cc v1.0.4
       Compiling num-rational v0.1.40
       Compiling num v0.1.41
       Compiling serde_codegen_internals v0.14.2
       Compiling scroll_derive v0.8.0
       Compiling symbolic-minidump v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/minidump)
       Compiling backtrace-sys v0.1.16
       Compiling scroll v0.8.0
       Compiling goblin v0.0.14
       Compiling serde_derive v0.9.15
       Compiling backtrace v0.3.5
       Compiling error-chain v0.11.0
       Compiling proguard v1.0.0
       Compiling symbolic-common v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/common)
       Compiling symbolic-sourcemap v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/sourcemap)
       Compiling symbolic-debuginfo v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/debuginfo)
       Compiling symbolic-proguard v2.0.3 (file:///tmp/tmpvW4P4d/rustsrc/proguard)
    warning: redundant linker flag specified for library `stdc++`

    error[E0308]: mismatched types
       --> /tmp/tmpvW4P4d/rustsrc/demangle/src/lib.rs:144:56
        |
    144 |         let rv = symbolic_demangle_swift(sym.as_ptr(), buf.as_mut_ptr(), buf.len(), simplified);
        |                                                        ^^^^^^^^^^^^^^^^ expected u8, found i8
        |
        = note: expected type `*mut u8`
                   found type `*mut i8`
        = help: here are some functions which might fulfill your needs:
                - .offset(...)
                - .wrapping_offset(...)

    error[E0308]: mismatched types
       --> /tmp/tmpvW4P4d/rustsrc/demangle/src/lib.rs:149:32
        |
    149 |         let s = CStr::from_ptr(buf.as_ptr()).to_string_lossy();
        |                                ^^^^^^^^^^^^ expected u8, found i8
        |
        = note: expected type `*const u8`
                   found type `*const i8`
        = help: here are some functions which might fulfill your needs:
                - .offset(...)
                - .wrapping_offset(...)

    error: aborting due to 2 previous errors

    error: Could not compile `symbolic-demangle`.
    warning: build failed, waiting for other jobs to finish...
    error: build failed

    ----------------------------------------
Command "/usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-Uu7sOt/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-z_VLqx-record/install-record.txt --single-version-externally-managed --compile" failed with error code 101 in /tmp/pip-build-Uu7sOt/symbolic/
root@d3d5d626ecc7:/t/symbolic# .offset(...)
bash: syntax error near unexpected token `...'

The goal is to install sentry via pip on ppc64le, but like I said, symbolic install failed.
Tried installing symbolic from source as well (on ubuntu:16.04), but getting same issue.

Any suggestions/comments appreciated. Thanks!

Failed to install via pip in CentOS 7, testing in all of v2.0.7 and v1.1.5

$ rustc --version
rustc 1.24.0
$ cargo --version
cargo 0.25.0
$ python --version
Python 2.7.5
$ pip --version
pip 1.3 from /xxx/sentry/lib/python2.7/site-packages/pip-1.3-py2.7.egg (python 2.7)

pip install symbolic or pip install symbolic==1.1.5

   Compiling symbolic-common v1.1.5 (file:///tmp/tmpK79nTN/rustsrc/common)

error[E0277]: the trait bound `errors::Error: std::convert::From<scroll::error::Error>` is not satisfied

   --> /tmp/tmpK79nTN/rustsrc/common/src/errors.rs:126:28

    |

126 |             Scroll(err) => Error::from(err),

    |                            ^^^^^^^^^^^ the trait `std::convert::From<scroll::error::Error>` is not implemented for `errors::Error`

    |

    = help: the following implementations were found:

              <errors::Error as std::convert::From<std::io::Error>>

              <errors::Error as std::convert::From<std::str::Utf8Error>>

              <errors::Error as std::convert::From<std::num::ParseIntError>>

              <errors::Error as std::convert::From<errors::ErrorKind>>

            and 7 others

    = note: required by `std::convert::From::from`



error: aborting due to previous error



error: Could not compile `symbolic-common`.



To learn more, run the command again with --verbose.

docs.rs build is broken

I went to look at the docs.rs page for symbolic and it gave an error message. Poking around a bit I found that this page exists which points to a build log where the crate is failing to build in docs.rs' system. The errors from the log are failing to compile some Breakpad sources:

running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-o" "/home/cratesfyi/cratesfyi/debug/build/symbolic-minidump-1530eb319d313ef2/out/third_party/breakpad/src/third_party/libdisasm/ia32_implicit.o" "-c" "third_party/breakpad/src/third_party/libdisasm/ia32_implicit.c"
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-o" "/home/cratesfyi/cratesfyi/debug/build/symbolic-minidump-1530eb319d313ef2/out/third_party/breakpad/src/third_party/libdisasm/ia32_settings.o" "-c" "third_party/breakpad/src/third_party/libdisasm/ia32_settings.c"
cargo:warning=cc: error: third_party/breakpad/src/third_party/libdisasm/ia32_implicit.c: No such file or directory
cargo:warning=cc: fatal error: no input files
cargo:warning=compilation terminated.
exit code: 1

I can reproduce this locally creating an empty crate with a dependency on symbolic with the minidump feature enabled:

[dependencies]
symbolic = { version = "5.7.8", features = ["minidump"] }

It looks like the published symbolic-minidump crate doesn't contain the Breakpad sources at all?

$ tar tzf /home/luser/.cargo/registry/cache/github.com-1ecc6299db9ec823/symbolic-minidump-5.7.8.crate
symbolic-minidump-5.7.8/Cargo.toml.orig
symbolic-minidump-5.7.8/Cargo.toml
symbolic-minidump-5.7.8/build.rs
symbolic-minidump-5.7.8/cpp/c_mapping.h
symbolic-minidump-5.7.8/cpp/c_string.cpp
symbolic-minidump-5.7.8/cpp/c_string.h
symbolic-minidump-5.7.8/cpp/data_definitions.h
symbolic-minidump-5.7.8/cpp/data_structures.cpp
symbolic-minidump-5.7.8/cpp/data_structures.h
symbolic-minidump-5.7.8/cpp/memstream.h
symbolic-minidump-5.7.8/cpp/mmap_symbol_supplier.cpp
symbolic-minidump-5.7.8/cpp/mmap_symbol_supplier.h
symbolic-minidump-5.7.8/cpp/processor.cpp
symbolic-minidump-5.7.8/cpp/processor.h
symbolic-minidump-5.7.8/src/cfi.rs
symbolic-minidump-5.7.8/src/lib.rs
symbolic-minidump-5.7.8/src/processor.rs
symbolic-minidump-5.7.8/src/registers.rs
symbolic-minidump-5.7.8/src/utils.rs
symbolic-minidump-5.7.8/tests/snapshots/cfi_elf.txt
symbolic-minidump-5.7.8/tests/snapshots/cfi_macho.txt
symbolic-minidump-5.7.8/tests/snapshots/cfi_sym_linux.txt
symbolic-minidump-5.7.8/tests/snapshots/cfi_sym_macos.txt
symbolic-minidump-5.7.8/tests/snapshots/cfi_sym_windows.txt
symbolic-minidump-5.7.8/tests/snapshots/process_state_linux.txt
symbolic-minidump-5.7.8/tests/snapshots/process_state_macos.txt
symbolic-minidump-5.7.8/tests/snapshots/process_state_windows.txt
symbolic-minidump-5.7.8/tests/snapshots/referenced_modules_linux.txt
symbolic-minidump-5.7.8/tests/snapshots/referenced_modules_macos.txt
symbolic-minidump-5.7.8/tests/snapshots/referenced_modules_windows.txt
symbolic-minidump-5.7.8/tests/test_cfi.rs
symbolic-minidump-5.7.8/tests/test_processor.rs

Symbolic demangle build failed on travis

I'm getting this error when compiling symbolic-demangle on travis:

  error occurred: Command "c++" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-g" "-fno-omit-frame-pointer" "-m64" "-I" "vendor/swift/include" "-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1" "-std=c++14" "-o" "/home/travis/build/sunng87/handlebars-rust/target/debug/build/symbolic-demangle-b3aaf8956174a00b/out/vendor/swift/lib/Demangling/Demangler.o" "-c" "vendor/swift/lib/Demangling/Demangler.cpp" with args "c++" did not execute successfully (status code exit code: 1).

You can find full information via this log:
https://travis-ci.org/github/sunng87/handlebars-rust/jobs/707920035

Let me know if you need any more information.

Issue in building Symbolic for ARM64

Using symbolic for sentry on arm64 architecture.

I get the below-mentioned error:
pip install symbolic

 Running setup.py install for symbolic ... error
    Complete output from command /www/sentry/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-ExkRly/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-OXXEHA/install-record.txt --single-version-externally-managed --compile --install-headers /www/sentry/include/site/python2.7/symbolic:
    running install
    running build
    running build_py
    creating build/lib
    creating build/lib/symbolic
    copying symbolic/common.py -> build/lib/symbolic
    copying symbolic/symcache.py -> build/lib/symbolic
    copying symbolic/exceptions.py -> build/lib/symbolic
    copying symbolic/proguard.py -> build/lib/symbolic
    copying symbolic/utils.py -> build/lib/symbolic
    copying symbolic/_compat.py -> build/lib/symbolic
    copying symbolic/debuginfo.py -> build/lib/symbolic
    copying symbolic/sourcemap.py -> build/lib/symbolic
    copying symbolic/demangle.py -> build/lib/symbolic
    copying symbolic/minidump.py -> build/lib/symbolic
    copying symbolic/__init__.py -> build/lib/symbolic
    error: [Errno 2] No such file or directory

The package used is Symbolic 5.0.2

Symbolic not Works

I have setup Sentry on localhost.
Symbolic is "activated" on INSTALLED_APPLICATIONS
but i don't can use the Symbolics:
bildschirmfoto von 2018-06-17 18-05-06

Do i need Symbol Server to use Minidump(/ Breakpad) Files

Issue reading dsym file (caused by.. type is too big)

Hello.
I want to use the symbolic library for symbolication of ios crash in linux.

Then, I run a below python code.

import os
from symbolic.symcache import SymCache
from symbolic.debuginfo import FatObject

arch = 'arm64'
path = os.path.join('<PATH>')
fo = FatObject.from_path(path)

I get the below-mentioned error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/symbolic/debuginfo.py", line 28, in from_path
    rustcall(lib.symbolic_fatobject_open, path))
  File "/usr/local/lib/python2.7/dist-packages/symbolic/utils.py", line 87, in rustcall
    raise exc
symbolic.ObjectErrorBadObject: failed to read object file
  caused by: type is too big (1818991) for 565248

Is there a workaround?

symcache line definition is capping to 65k

I'm having issues symbolicating files with more than 65k lines like sqlite3.c. Everything points to LineRecord definition (https://github.com/getsentry/symbolic/blob/master/symcache/src/format.rs#L242) and writer logic (line: std::cmp::min(line.line, std::u16::MAX.into()) as u16) where u16 should be u32 instead (https://github.com/getsentry/symbolic/blob/master/symcache/src/writer.rs#L446)

e.g.:

The following symbolicated frame should have line 115772 but it's clipped to 65535

{
        "abs_path": "../../../../../../../third-party/sqlite3/src/sqlite3.c",
        "base_dir": "../../../../../../../third-party/sqlite3/src",
        "comp_dir": ".",
        "filename": "sqlite3.c",
        "function_name": "sqlite3_exec",
        "instr_addr": 6815687,
        "lang": "c",
        "line": 65535,
        "line_addr": 6815614,
        "rel_path": "../../../../../../../third-party/sqlite3/src/sqlite3.c",
        "sym_addr": 6815388,
        "symbol": "sqlite3_exec"
}

cpp_demangle patch bump

Hey there :)

Just noticed this morning as I ran cargo update on my project that cpp_demangle made a breaking change in the 0.2.17 version.

cpp_demangle::DemangleOptions now has a no_return_type field which causes an issue in symbolic-demangle lib.rs

error[E0063]: missing field `no_return_type` in initializer of `cpp_demangle::DemangleOptions`
   --> <MY HOME FOLDER>/.cargo/registry/src/github.com-1ecc6299db9ec823/symbolic-demangle-6.1.4/src/lib.rs:126:16
    |
126 |     let opts = CppOptions {
    |                ^^^^^^^^^^ missing `no_return_type`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0063`.
error: could not compile `symbolic-demangle`.

I can send you a patch if it makes sense, but the version bump if any might be a tuff decision to make ^^

Please let me know if there's anything I can do :)

Export more minidump attributes

Minidump has some more useful attributes that we should expose:

  • requesting_thread: u32
  • time_date_stamp: u32
  • crash_reason: String
  • crash_address: u64
  • assertion: String
  • system_info:
    • os: String
    • os_short: String
    • os_version: String
    • cpu: String
    • cpu_info: String
    • cpu_count: u32
  • exploitability: enum

swift-demangle needs to be updated for Swift 5.2

I'm seeing certain symbols that don't demangle when using symbolic.demangle.demangle_name:

>>> import symbolic
>>> symbolic.demangle.demangle_name('s29example_ios_scenarios_sources7CPUViewV4bodyQrvg7SwiftUI9TupleViewVyAE0J0PAEE7paddingyQrAE4EdgeO3SetV_12CoreGraphics7CGFloatVSgtFQOyAE4TextV_Qo__AtiEEAJyQrAN_ARtFQOyAE6HStackVyAGyAT_AE7StepperVyATGtGG_Qo_AWyAGyAE6ButtonVyATG_A4_AA17ActivityIndicatorVtGGATSgtGyXEfU_')
's29example_ios_scenarios_sources7CPUViewV4bodyQrvg7SwiftUI9TupleViewVyAE0J0PAEE7paddingyQrAE4EdgeO3SetV_12CoreGraphics7CGFloatVSgtFQOyAE4TextV_Qo__AtiEEAJyQrAN_ARtFQOyAE6HStackVyAGyAT_AE7StepperVyATGtGG_Qo_AWyAGyAE6ButtonVyATG_A4_AA17ActivityIndicatorVtGGATSgtGyXEfU_'

With xcrun swift-demangle (Xcode 11.4) this works:

$ xcrun swift-demangle -compact s29example_ios_scenarios_sources7CPUViewV4bodyQrvg7SwiftUI9TupleViewVyAE0J0PAEE7paddingyQrAE4EdgeO3SetV_12CoreGraphics7CGFloatVSgtFQOyAE4TextV_Qo__AtiEEAJyQrAN_ARtFQOyAE6HStackVyAGyAT_AE7StepperVyATGtGG_Qo_AWyAGyAE6ButtonVyATG_A4_AA17ActivityIndicatorVtGGATSgtGyXEfU_
closure #1 () -> SwiftUI.TupleView<(<<opaque return type of (extension in SwiftUI):SwiftUI.View.padding(SwiftUI.Edge.Set, CoreGraphics.CGFloat?) -> some>>.0, SwiftUI.Text, <<opaque return type of (extension in SwiftUI):SwiftUI.View.padding(SwiftUI.Edge.Set, CoreGraphics.CGFloat?) -> some>>.0, SwiftUI.HStack<SwiftUI.TupleView<(SwiftUI.Button<SwiftUI.Text>, SwiftUI.Button<SwiftUI.Text>, example_ios_scenarios_sources.ActivityIndicator)>>, SwiftUI.Text?)> in example_ios_scenarios_sources.CPUView.body.getter : some

Support Code snippets/Context for lua (or any language)

Hi there,

We currently have some middle-man service we use to report lua crashes to sentry. That service build a json payload, and look at a companion zip file containing all the source code to set the code snippets/context fields.

We would like to kill that middle-man service, and instead use a 'normal' sentry solution. Up until a certain point, I was thinking about building a fake javascript sourcemap file, and masquerade our lua crash as javascript. Is that viable ? It doesn't sound too good if you guys one day start to parse the source-map files and bail out because the syntax is not javascript.

Do we need a new solution for that use case ? I created the ticket here but maybe it belongs in the sentry project.

Thanks for any pointer !

Compilation error with nightly-2020-06-24

Just run cargo build in the base directory and you'll get:

   Compiling symbolic-debuginfo v7.4.0 (/home/calixte/dev/mozilla/symbolic/debuginfo)
error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements
   --> debuginfo/src/object.rs:348:23
    |
348 |         Box::new(self.symbols())
    |                       ^^^^^^^
    |
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 347:5...
   --> debuginfo/src/object.rs:347:5
    |
347 | /     fn symbols(&self) -> DynIterator<'_, Symbol<'_>> {
348 | |         Box::new(self.symbols())
349 | |     }
    | |_____^
note: ...so that the types are compatible
   --> debuginfo/src/object.rs:348:9
    |
348 |         Box::new(self.symbols())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: expected `base::Symbol<'_>`
               found `base::Symbol<'_>`
note: but, the lifetime must be valid for the lifetime `'d` as defined on the impl at 311:6...
   --> debuginfo/src/object.rs:311:6
    |
311 | impl<'d> ObjectLike for Object<'d> {
    |      ^^
note: ...so that the types are compatible
   --> debuginfo/src/object.rs:348:23
    |
348 |         Box::new(self.symbols())
    |                       ^^^^^^^
    = note: expected `&object::Object<'_>`
               found `&object::Object<'d>`

error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'d` due to conflicting requirements
   --> debuginfo/src/pdb.rs:294:23
    |
294 |         Box::new(self.symbols())
    |                       ^^^^^^^
    |
note: first, the lifetime cannot outlive the anonymous lifetime #1 defined on the method body at 293:5...
   --> debuginfo/src/pdb.rs:293:5
    |
293 | /     fn symbols(&self) -> DynIterator<'_, Symbol<'_>> {
294 | |         Box::new(self.symbols())
295 | |     }
    | |_____^
note: ...so that the types are compatible
   --> debuginfo/src/pdb.rs:294:9
    |
294 |         Box::new(self.symbols())
    |         ^^^^^^^^^^^^^^^^^^^^^^^^
    = note: expected `base::Symbol<'_>`
               found `base::Symbol<'_>`
note: but, the lifetime must be valid for the lifetime `'d` as defined on the impl at 261:6...
   --> debuginfo/src/pdb.rs:261:6
    |
261 | impl<'d> ObjectLike for PdbObject<'d> {
    |      ^^
note: ...so that the types are compatible
   --> debuginfo/src/pdb.rs:294:23
    |
294 |         Box::new(self.symbols())
    |                       ^^^^^^^
    = note: expected `&pdb::PdbObject<'_>`
               found `&pdb::PdbObject<'d>`

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0495`.
error: could not compile `symbolic-debuginfo`.

To learn more, run the command again with --verbose.

[debuginfo] Don't return an error when it isn't possible to resolve a name

Some functions are skipped because an error is returned when trying to resolve a function name using a reference.
I met some case where the references (via abstract_origin) are wrong (they don't point to a DIE).
If such a function is an inlinee then the inliner is skipped which is pretty bad.
I think that in such a case the resolve_function_name should return something like <name omitted>, it's probably better to have an incomplete information instead of removing the inliner.
We could do the same for resolve_file.

Impossible to install on SmartOS (solaris) via pip

When installing on SmartOS via pip, symbolic-2.0.3.zip will be downloaded when the installation will fail.

When running pip install symbolic I get :

Collecting symbolic
  Downloading symbolic-2.0.3.zip (5.6MB)
    100% |################################| 5.6MB 206kB/s 
Requirement already satisfied: milksnake in /opt/local/lib/python2.7/site-packages (from symbolic)
Requirement already satisfied: cffi>=1.6.0 in /opt/local/lib/python2.7/site-packages (from milksnake->symbolic)
Requirement already satisfied: pycparser in /opt/local/lib/python2.7/site-packages (from cffi>=1.6.0->milksnake->symbolic)
Installing collected packages: symbolic
  Running setup.py install for symbolic ... error
    Complete output from command /opt/local/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sRtAcz/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ncsN74-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.solaris-2.11-i86pc.64bit-2.7
    creating build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/_compat.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/exceptions.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/minidump.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/__init__.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/demangle.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/symcache.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/sourcemap.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/common.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/utils.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/proguard.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    copying symbolic/debuginfo.py -> build/lib.solaris-2.11-i86pc.64bit-2.7/symbolic
    error: [Errno 2] No such file or directory
    
    ----------------------------------------
Command "/opt/local/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-sRtAcz/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-ncsN74-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-sRtAcz/symbolic/

I have really no idea how to fix this issue. The goal is to install sentry via pip on SmartOS, but like I said, symbolic install failed.

When I try to install symbolic-2.0.3.zip (via python setup.py install) on my linux machine (Ubuntu 17.10), I encounter the same issue (if that helps).

Thanks in advance for any help !

Symbolic fail to install in FreeBSD

Im trying to install symbolic from pip, Im using pkgsrc on a FreeBSD server with clang compiler

$ rustc --version
rustc 1.24.1
$ cargo --version
cargo 0.25.0
$ uname -a
FreeBSD rcms 11.1-RELEASE-p9 FreeBSD 11.1-RELEASE-p9 #0: Tue Apr 3 16:59:16 UTC 2018 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64
$ /usr/pkg/bin/virtualenv-2.7 env
New python executable in /usr/home/urcms/env/bin/python2.7
Also creating executable in /usr/home/urcms/env/bin/python
Installing setuptools, pip, wheel...done.
$ . ./env/bin/activate
(env) $ pip --version
pip 10.0.1 from /usr/home/urcms/env/lib/python2.7/site-packages/pip (python 2.7)
(env) $ pip install symbolic
Collecting symbolic
Using cached https://files.pythonhosted.org/packages/9d/8a/6e99dec6cb6104eec894d4f98779a6c51ca628c0faa2583eb2565b996c5f/symbolic-5.0.1.zip
Collecting milksnake>=0.1.2 (from symbolic)
Using cached https://files.pythonhosted.org/packages/27/be/e10e73f857ac98ef43587fa8db37a3ef6de56e728037a7b9728de26711c7/milksnake-0.1.5-py2.py3-none-any.whl
Collecting cffi>=1.6.0 (from milksnake>=0.1.2->symbolic)
Collecting pycparser (from cffi>=1.6.0->milksnake>=0.1.2->symbolic)
Building wheels for collected packages: symbolic
Running setup.py bdist_wheel for symbolic ... error
Complete output from command /usr/home/urcms/env/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-install-VRV714/symbolic/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/pip-wheel-afRC5h --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build/lib
creating build/lib/symbolic
copying symbolic/proguard.py -> build/lib/symbolic
copying symbolic/utils.py -> build/lib/symbolic
copying symbolic/demangle.py -> build/lib/symbolic
copying symbolic/_compat.py -> build/lib/symbolic
copying symbolic/sourcemap.py -> build/lib/symbolic
copying symbolic/exceptions.py -> build/lib/symbolic
copying symbolic/debuginfo.py -> build/lib/symbolic
copying symbolic/common.py -> build/lib/symbolic
copying symbolic/symcache.py -> build/lib/symbolic
copying symbolic/init.py -> build/lib/symbolic
copying symbolic/minidump.py -> build/lib/symbolic
Updating registry https://github.com/rust-lang/crates.io-index
Compiling either v1.5.0
Compiling num-traits v0.2.2
Compiling fallible-iterator v0.1.4
Compiling fnv v1.0.6
Compiling unicode-xid v0.1.0
Compiling strsim v0.7.0
Compiling lazy_static v1.0.0
Compiling serde v1.0.43
Compiling percent-encoding v1.0.1
Compiling unicode-width v0.1.4
Compiling byteorder v1.2.2
Compiling stable_deref_trait v1.0.0
Compiling memoffset v0.2.1
Compiling lazy_static v0.2.11
Compiling quote v0.3.15
Compiling scopeguard v0.3.3
Compiling void v1.0.2
Compiling ucd-util v0.1.1
Compiling libc v0.2.40
Compiling unicode-xid v0.0.4
Compiling semver-parser v0.7.0
Compiling regex v0.2.10
Compiling matches v0.1.6
Compiling nodrop v0.1.12
Compiling if_chain v0.1.2
Compiling rustc-serialize v0.3.24
Compiling ansi_term v0.11.0
Compiling cfg-if v0.1.2
Compiling unicode-normalization v0.1.5
Compiling vec_map v0.8.0
Compiling pdqsort v0.1.2
Compiling dtoa v0.4.2
Compiling bitflags v1.0.1
Compiling sha1 v0.6.0
Compiling rustc-demangle v0.1.7
Compiling itoa v0.3.4
Compiling serde v0.9.15
Compiling utf8-ranges v1.0.0
Compiling linked-hash-map v0.4.2
Compiling rayon-core v1.4.0
Compiling glob v0.2.11
Compiling plain v0.2.3
Compiling num-traits v0.1.43
Compiling num-integer v0.1.36
Compiling proc-macro2 v0.3.7
Compiling textwrap v0.9.0
Compiling base64 v0.4.2
Compiling owning_ref v0.3.3
Compiling unreachable v1.0.0
Compiling regex-syntax v0.5.5
Compiling memmap v0.6.2
Compiling rand v0.4.2
Compiling atty v0.2.9
Compiling memmap v0.5.2
Compiling num_cpus v1.8.0
Compiling memchr v2.0.1
Compiling synom v0.11.3
Compiling semver v0.9.0
Compiling unicode-bidi v0.3.4
Compiling arrayvec v0.4.7
Compiling num-complex v0.1.43
Compiling log v0.4.1
Compiling crossbeam-utils v0.2.2
Compiling dmsort v0.1.3
Compiling lru-cache v0.1.1
Compiling cpp_demangle v0.2.7
Compiling serde_json v0.9.10
Compiling num-iter v0.1.35
Compiling quote v0.5.2
Compiling thread_local v0.3.5
Compiling uuid v0.6.3
Compiling num-bigint v0.1.43
Compiling clap v2.31.2
Compiling aho-corasick v0.6.4
Compiling syn v0.11.11
Compiling rustc_version v0.2.2
Compiling idna v0.1.4
Compiling gimli v0.15.0
Compiling crossbeam-epoch v0.3.1
Compiling syn v0.13.1
Compiling num-rational v0.1.42
Compiling serde_codegen_internals v0.14.2
Compiling synstructure v0.6.1
Compiling sourcemap v2.2.0
Compiling url v1.7.0
Compiling crossbeam-deque v0.2.0
Compiling scroll_derive v0.9.3
Compiling num v0.1.42
Compiling proguard v1.1.0
Compiling serde_derive v0.9.15
Compiling failure_derive v0.1.1
Compiling scroll v0.9.0
Compiling rayon v1.0.1
Compiling goblin v0.0.15
Compiling cc v1.0.10
Compiling symbolic-minidump v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/minidump)
Compiling symbolic-demangle v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/demangle)
Compiling backtrace-sys v0.1.16
warning: third_party/breakpad/src/third_party/libdisasm/x86_format.c:465:17: warning: comparison of constant 16 with expression of type 'enum x86_insn_group' is always false [-Wtautological-constant-out-of-range-compare]
warning: if ( gp > sizeof (types)/sizeof(types[0]) )
warning: ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: 1 warning generated.
Compiling backtrace v0.3.6
Compiling error-chain v0.11.0
Compiling failure v0.1.1
Compiling symbolic-common v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/common)
Compiling symbolic-sourcemap v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/sourcemap)
Compiling symbolic-debuginfo v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/debuginfo)
Compiling symbolic-proguard v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/proguard)
Compiling symbolic-symcache v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/symcache)
Compiling symbolic v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc)
Compiling symbolic-cabi v5.0.1 (file:///tmp/tmpQGGOzQ/rustsrc/cabi)
error: paths in use groups are experimental (see issue #44494)
--> src/minidump.rs:7:24
|
7 | use symbolic::common::{byteview::ByteView, types::Arch};
| ^^^^^^^^^^^^^^^^^^

error: paths in use groups are experimental (see issue #44494)
--> src/minidump.rs:7:44
|
7 | use symbolic::common::{byteview::ByteView, types::Arch};
| ^^^^^^^^^^^

error: paths in use groups are experimental (see issue #44494)
--> src/symcache.rs:6:24
|
6 | use symbolic::common::{byteview::ByteView, types::Arch};
| ^^^^^^^^^^^^^^^^^^

error: paths in use groups are experimental (see issue #44494)
--> src/symcache.rs:6:44
|
6 | use symbolic::common::{byteview::ByteView, types::Arch};
| ^^^^^^^^^^^

error: aborting due to 4 previous errors

error: Could not compile symbolic-cabi.

To learn more, run the command again with --verbose.


Failed building wheel for symbolic
Running setup.py clean for symbolic
Failed to build symbolic
Installing collected packages: pycparser, cffi, milksnake, symbolic
Running setup.py install for symbolic ... error
Complete output from command /usr/home/urcms/env/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-install-VRV714/symbolic/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-FQmqBa/install-record.txt --single-version-externally-managed --compile --install-headers /usr/home/urcms/env/include/site/python2.7/symbolic:
running install
running build
running build_py
creating build/lib
creating build/lib/symbolic
copying symbolic/proguard.py -> build/lib/symbolic
copying symbolic/utils.py -> build/lib/symbolic
copying symbolic/demangle.py -> build/lib/symbolic
copying symbolic/_compat.py -> build/lib/symbolic
copying symbolic/sourcemap.py -> build/lib/symbolic
copying symbolic/exceptions.py -> build/lib/symbolic
copying symbolic/debuginfo.py -> build/lib/symbolic
copying symbolic/common.py -> build/lib/symbolic
copying symbolic/symcache.py -> build/lib/symbolic
copying symbolic/init.py -> build/lib/symbolic
copying symbolic/minidump.py -> build/lib/symbolic
Updating registry https://github.com/rust-lang/crates.io-index
Compiling stable_deref_trait v1.0.0
Compiling unicode-width v0.1.4
Compiling serde v1.0.43
Compiling itoa v0.3.4
Compiling fnv v1.0.6
Compiling unicode-normalization v0.1.5
Compiling linked-hash-map v0.4.2
Compiling libc v0.2.40
Compiling glob v0.2.11
Compiling num-traits v0.2.2
Compiling byteorder v1.2.2
Compiling lazy_static v1.0.0
Compiling serde v0.9.15
Compiling quote v0.3.15
Compiling void v1.0.2
Compiling pdqsort v0.1.2
Compiling sha1 v0.6.0
Compiling vec_map v0.8.0
Compiling fallible-iterator v0.1.4
Compiling ansi_term v0.11.0
Compiling semver-parser v0.7.0
Compiling lazy_static v0.2.11
Compiling plain v0.2.3
Compiling percent-encoding v1.0.1
Compiling memoffset v0.2.1
Compiling regex v0.2.10
Compiling unicode-xid v0.0.4
Compiling either v1.5.0
Compiling utf8-ranges v1.0.0
Compiling rayon-core v1.4.0
Compiling matches v0.1.6
Compiling rustc-demangle v0.1.7
Compiling bitflags v1.0.1
Compiling scopeguard v0.3.3
Compiling strsim v0.7.0
Compiling ucd-util v0.1.1
Compiling nodrop v0.1.12
Compiling dtoa v0.4.2
Compiling cfg-if v0.1.2
Compiling if_chain v0.1.2
Compiling unicode-xid v0.1.0
Compiling rustc-serialize v0.3.24
Compiling owning_ref v0.3.3
Compiling textwrap v0.9.0
Compiling lru-cache v0.1.1
Compiling rand v0.4.2
Compiling memchr v2.0.1
Compiling num_cpus v1.8.0
Compiling atty v0.2.9
Compiling memmap v0.5.2
Compiling memmap v0.6.2
Compiling cpp_demangle v0.2.7
Compiling num-integer v0.1.36
Compiling num-traits v0.1.43
Compiling base64 v0.4.2
Compiling unreachable v1.0.0
Compiling dmsort v0.1.3
Compiling semver v0.9.0
Compiling synom v0.11.3
Compiling unicode-bidi v0.3.4
Compiling regex-syntax v0.5.5
Compiling arrayvec v0.4.7
Compiling log v0.4.1
Compiling crossbeam-utils v0.2.2
Compiling proc-macro2 v0.3.7
Compiling num-complex v0.1.43
Compiling uuid v0.6.3
Compiling aho-corasick v0.6.4
Compiling clap v2.31.2
Compiling num-iter v0.1.35
Compiling num-bigint v0.1.43
Compiling serde_json v0.9.10
Compiling thread_local v0.3.5
Compiling rustc_version v0.2.2
Compiling syn v0.11.11
Compiling idna v0.1.4
Compiling gimli v0.15.0
Compiling crossbeam-epoch v0.3.1
Compiling quote v0.5.2
Compiling num-rational v0.1.42
Compiling sourcemap v2.2.0
Compiling serde_codegen_internals v0.14.2
Compiling synstructure v0.6.1
Compiling url v1.7.0
Compiling crossbeam-deque v0.2.0
Compiling syn v0.13.1
Compiling num v0.1.42
Compiling proguard v1.1.0
Compiling serde_derive v0.9.15
Compiling failure_derive v0.1.1
Compiling scroll_derive v0.9.3
Compiling rayon v1.0.1
Compiling scroll v0.9.0
Compiling cc v1.0.10
Compiling goblin v0.0.15
Compiling symbolic-demangle v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/demangle)
Compiling symbolic-minidump v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/minidump)
Compiling backtrace-sys v0.1.16
warning: third_party/breakpad/src/third_party/libdisasm/x86_format.c:465:17: warning: comparison of constant 16 with expression of type 'enum x86_insn_group' is always false [-Wtautological-constant-out-of-range-compare]
warning: if ( gp > sizeof (types)/sizeof(types[0]) )
warning: ~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: 1 warning generated.
Compiling backtrace v0.3.6
Compiling failure v0.1.1
Compiling error-chain v0.11.0
Compiling symbolic-common v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/common)
Compiling symbolic-sourcemap v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/sourcemap)
Compiling symbolic-debuginfo v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/debuginfo)
Compiling symbolic-proguard v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/proguard)
Compiling symbolic-symcache v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/symcache)
Compiling symbolic v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc)
Compiling symbolic-cabi v5.0.1 (file:///tmp/tmpf6mrlt/rustsrc/cabi)
error: paths in use groups are experimental (see issue #44494)
--> src/minidump.rs:7:24
|
7 | use symbolic::common::{byteview::ByteView, types::Arch};
| ^^^^^^^^^^^^^^^^^^

error: paths in `use` groups are experimental (see issue #44494)
 --> src/minidump.rs:7:44
  |
7 | use symbolic::common::{byteview::ByteView, types::Arch};
  |                                            ^^^^^^^^^^^

error: paths in `use` groups are experimental (see issue #44494)
 --> src/symcache.rs:6:24
  |
6 | use symbolic::common::{byteview::ByteView, types::Arch};
  |                        ^^^^^^^^^^^^^^^^^^

error: paths in `use` groups are experimental (see issue #44494)
 --> src/symcache.rs:6:44
  |
6 | use symbolic::common::{byteview::ByteView, types::Arch};
  |                                            ^^^^^^^^^^^

error: aborting due to 4 previous errors

error: Could not compile `symbolic-cabi`.

To learn more, run the command again with --verbose.

----------------------------------------

Command "/usr/home/urcms/env/bin/python2.7 -u -c "import setuptools, tokenize;file='/tmp/pip-install-VRV714/symbolic/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-FQmqBa/install-record.txt --single-version-externally-managed --compile --install-headers /usr/home/urcms/env/include/site/python2.7/symbolic" failed with error code 101 in /tmp/pip-install-VRV714/symbolic/

Pdb support

FatObject currently does not attempt to support pdb files. Are you interested in adding pdb support?

The pdb crate seems to have the necessary capabilities: It exposes the guid + age (which form the DebugId) and it provides a symbol iterator. And the msvc-demangler crate is shaping up to provide adequate demangling for Windows C++ symbols.

I'm interested in helping with the implementation, if this is deemed to be a desirable addition.

symbolic fails lookup if there are no line records

With symbolic 7.5.0 and this sym file:

MODULE windows x86_64 09F9D7ECF31F60E34C4C44205044422E1 xul.pdb
INFO CODE_ID 5E8F310E69D0000 xul.dll
FILE 0 hg:hg.mozilla.org/mozilla-central:vs2017_15.8.4/VC/include/functional:93bdbca5399c12b3eec5f03bbc323e00f7ef3a51
FUNC c6db60 f 0 std::_Func_impl_no_alloc<`lambda at /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpChannelChild.cpp:411:7',void>::_Move(void*)
c6db60 f 1219 0
FUNC c6db70 23e 0 std::_Func_impl_no_alloc<`lambda at /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpChannelChild.cpp:411:7',void>::_Do_call()
FUNC c6ddb0 8 0 std::_Func_impl_no_alloc<`lambda at /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpChannelChild.cpp:411:7',void>::_Target_type() const
c6ddb0 8 1227 0
FUNC c6ddc0 209 0 std::_Func_impl_no_alloc<`lambda at /builds/worker/checkouts/gecko/netwerk/protocol/http/HttpChannelChild.cpp:411:7',void>::_Delete_this(bool)
c6ddc0 b 1239 0
c6ddcb 102 1240 0
c6decd 8 1241 0
c6ded5 10 1243 0

this Python code fails:

import symbolic

debug_id = symbolic.normalize_debug_id("09F9D7ECF31F60E34C4C44205044422E1")
archive = symbolic.Archive.open("xul.sym")
obj = archive.get_object(debug_id=debug_id)
symcache = obj.make_symcache()
lineinfo = symcache.lookup("0xc6dd98")

print(lineinfo)                         

lineinfo ends up being an empty list because symbolic can't resolve the address. I think it's because there are no line records for that function.

I think one of the following is true:

  1. our sym file is malformed--maybe there's a rule that you must have line records for a FUNC?
  2. symbolic should handle this case and return what information it can for that symbol

Any ideas? Thank you!

BSD support: make detection, ...

I had to temporarily symlink make to gmake to get things working.

If I pip install symbolic, I currently get a symbolic==5.0.2, which builds and install just fine.

Sentry 8.22 however is pinned against symbolic==1.1.5, which fails to build:

...
Compiling symbolic-common v1.1.5 (file:///tmp/tmp71PE2W/rustsrc/common)
    error[E0277]: the trait bound `errors::Error: std::convert::From<scroll::error::Error>` is not satisfied
       --> /tmp/tmp71PE2W/rustsrc/common/src/errors.rs:126:28
        |
    126 |             Scroll(err) => Error::from(err),
        |                            ^^^^^^^^^^^ the trait `std::convert::From<scroll::error::Error>` is not implemented for `errors::Error`
        |
        = help: the following implementations were found:
                  <errors::Error as std::convert::From<std::io::Error>>
                  <errors::Error as std::convert::From<std::str::Utf8Error>>
                  <errors::Error as std::convert::From<std::num::ParseIntError>>
                  <errors::Error as std::convert::From<errors::ErrorKind>>
                and 7 others
        = note: required by `std::convert::From::from`

    error: aborting due to previous error

    error: Could not compile `symbolic-common`.

    To learn more, run the command again with --verbose.
error
  Rolling back uninstall of symbolic
...

$ rustc -V
rustc 1.25.0
$ uname -v
FreeBSD 11.1-RELEASE-p8 #0: Tue Mar 13 17:07:05 UTC 2018     [email protected]:/usr/obj/usr/src/sys/GENERIC 

That's on rust 1.25.0; Not sure if you're still interested in that. It doesn't look very FreeBSD-specific.

Is there a way forward when using/in combination with Sentry?

pip install fail building from source v1.1.5 (fixed in master?)

fails

root@demr-sentry:/tmp/tmp.oEhGBl # pip install --no-binary :all: symbolic
Collecting symbolic
  Using cached symbolic-1.1.5.zip
Collecting milksnake (from symbolic)
  Downloading milksnake-0.1.1.zip
Collecting cffi>=1.6.0 (from milksnake->symbolic)
  Using cached cffi-1.11.2.tar.gz
Collecting pycparser (from cffi>=1.6.0->milksnake->symbolic)
  Using cached pycparser-2.18.tar.gz
Skipping bdist_wheel for symbolic, due to binaries being disabled for it.
Skipping bdist_wheel for milksnake, due to binaries being disabled for it.
Skipping bdist_wheel for cffi, due to binaries being disabled for it.
Skipping bdist_wheel for pycparser, due to binaries being disabled for it.
Installing collected packages: pycparser, cffi, milksnake, symbolic
  Running setup.py install for pycparser ... done
  Running setup.py install for cffi ... done
  Running setup.py install for milksnake ... done
  Running setup.py install for symbolic ... error
    Complete output from command /usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-kez8y9/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-B4dWEr-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/proguard.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/utils.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/debuginfo.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/symcache.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/__init__.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/sourcemap.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/exceptions.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/_compat.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/minidump.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/demangle.py -> build/lib.linux-x86_64-2.7/symbolic
    copying symbolic/common.py -> build/lib.linux-x86_64-2.7/symbolic
        Updating registry `https://github.com/rust-lang/crates.io-index`
        Updating git repository `https://github.com/m4b/goblin`
    warning: package replacement is not used: https://github.com/rust-lang/crates.io-index#goblin:0.0.11
       Compiling void v1.0.2
       Compiling pdqsort v0.1.2
       Compiling semver-parser v0.7.0
       Compiling rustc-serialize v0.3.24
       Compiling scroll v0.7.0
       Compiling matches v0.1.6
       Compiling unicode-xid v0.0.4
       Compiling percent-encoding v1.0.1
       Compiling itoa v0.3.4
       Compiling cc v1.0.3
       Compiling serde v1.0.24
       Compiling nodrop v0.1.12
       Compiling utf8-ranges v1.0.0
       Compiling sha1 v0.2.0
       Compiling lazy_static v1.0.0
       Compiling dtoa v0.4.2
       Compiling serde v0.9.15
       Compiling if_chain v0.1.2
       Compiling unicode-normalization v0.1.5
       Compiling byteorder v1.2.1
       Compiling fallible-iterator v0.1.3
       Compiling plain v0.2.3
       Compiling cfg-if v0.1.2
       Compiling rustc-demangle v0.1.5
       Compiling fnv v1.0.6
       Compiling quote v0.3.15
       Compiling num-traits v0.1.41
       Compiling log v0.3.8
       Compiling libc v0.2.34
       Compiling regex-syntax v0.4.1
       Compiling lazy_static v0.2.11
       Compiling gcc v0.3.54
       Compiling stable_deref_trait v1.0.0
       Compiling linked-hash-map v0.4.2
       Compiling symbolic-minidump v1.1.5 (file:///tmp/tmpOEicfA/rustsrc/minidump)
       Compiling unreachable v1.0.0
       Compiling unicode-bidi v0.3.4
       Compiling dmsort v0.1.3
       Compiling synom v0.11.3
       Compiling arrayvec v0.4.6
       Compiling base64 v0.4.2
       Compiling semver v0.6.0
       Compiling num-integer v0.1.35
       Compiling memmap v0.5.2
       Compiling rand v0.3.18
       Compiling memchr v2.0.1
       Compiling owning_ref v0.3.3
       Compiling lru-cache v0.1.1
       Compiling thread_local v0.3.5
       Compiling syn v0.11.11
       Compiling gimli v0.15.0
       Compiling idna v0.1.4
       Compiling num-iter v0.1.34
       Compiling backtrace-sys v0.1.16
       Compiling rustc_version v0.2.1
       Compiling aho-corasick v0.6.4
       Compiling uuid v0.5.1
       Compiling serde_json v0.9.10
       Compiling num-complex v0.1.41
       Compiling symbolic-demangle v1.1.5 (file:///tmp/tmpOEicfA/rustsrc/demangle)
       Compiling num-bigint v0.1.41
       Compiling sourcemap v2.2.0
       Compiling url v1.6.0
       Compiling regex v0.2.3
       Compiling num-rational v0.1.40
       Compiling num v0.1.41
       Compiling backtrace v0.3.4
       Compiling error-chain v0.11.0
       Compiling scroll_derive v0.8.0
       Compiling serde_codegen_internals v0.14.2
       Compiling scroll v0.8.0
       Compiling serde_derive v0.9.15
       Compiling goblin v0.0.13
       Compiling proguard v1.0.0
       Compiling symbolic-common v1.1.5 (file:///tmp/tmpOEicfA/rustsrc/common)
    error[E0277]: the trait bound `errors::Error: std::convert::From<scroll::error::Error>` is not satisfied
       --> /tmp/tmpOEicfA/rustsrc/common/src/errors.rs:126:28
        |
    126 |             Scroll(err) => Error::from(err),
        |                            ^^^^^^^^^^^ the trait `std::convert::From<scroll::error::Error>` is not implemented for `errors::Error`
        |
        = help: the following implementations were found:
                  <errors::Error as std::convert::From<std::io::Error>>
                  <errors::Error as std::convert::From<std::str::Utf8Error>>
                  <errors::Error as std::convert::From<std::num::ParseIntError>>
                  <errors::Error as std::convert::From<errors::ErrorKind>>
                and 7 others
        = note: required by `std::convert::From::from`

    error: aborting due to previous error

    error: Could not compile `symbolic-common`.

    To learn more, run the command again with --verbose.

    ----------------------------------------
Command "/usr/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-kez8y9/symbolic/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-B4dWEr-record/install-record.txt --single-version-externally-managed --compile" failed with error code 101 in /tmp/pip-build-kez8y9/symbolic/

works with master

git clone https://github.com/getsentry/symbolic
cd symbolic
git submodule update --init --recursive
cd py
python setup.py bdist_wheel
# create successfully dist/symbolic-1.1.5-py2.py3-none-linux_x86_64.whl
root@demr-sentry:/ # rustc --version
rustc 1.22.1
root@demr-sentry:/ # cargo --version
cargo 0.22.0
root@demr-sentry:/ # uname -a
Linux demr-sentry 4.9.49-moby #1 SMP Fri Dec 8 13:40:02 UTC 2017 x86_64 Linux
root@demr-sentry:/ # cat /etc/apk/repositories
http://dl-cdn.alpinelinux.org/alpine/edge/main
http://dl-cdn.alpinelinux.org/alpine/edge/community

symbolic fails lookup if the lookup address doesn't line up exactly with line record

When symbolic looks up 0x3c105a1 in xul.pdb/88FD491257B2E0F54C4C44205044422E1, it fails the lookup, but it should return Interpret(JSContext*, js::RunState&).

The sym file is at: https://symbols.mozilla.org/xul.pdb/88FD491257B2E0F54C4C44205044422E1/xul.sym

Here's the relevant bits in the sym file:

MODULE windows x86_64 88FD491257B2E0F54C4C44205044422E1 xul.pdb
INFO CODE_ID 5ED439916EB4000 xul.dll
...
FILE 16693 hg:hg.mozilla.org/mozilla-central:js/src/vm/Interpreter.cpp:e4b11f027efc1f8c2710ae3f52487a8f10a8fb39
...
FUNC 3c01d20 1f6e8 0 Interpret(JSContext*, js::RunState&)
...
3c104e1 c 3021 16693
3c104ed 10 3070 16693
3c104fd e2 3071 16693
3c105df 10 3076 16693
3c105ef 9 3077 16693
3c105f8 c 3078 16693
3c10604 20 3079 16693

Breakpad stackwalker returns Interpret(JSContext*, js::RunState&) at js/src/vm/Interpreter.cpp:3071.

Add WASM Support

This is a formal issue as follow up to the initial investigations in #166. The goal is to enable WASM DWARF handling to the extent this is possible with the current state of affairs in the WASM world. This issue is to figure out best next steps since we need to operate within the realities of what runtime environments are likely to have access to.

WASM DWARF

Compilers place DWARF in custom sections directly in the WASM file, which can be accessed and read through the browser API. Similar to Linux, the section names are prefixed with ., for instance .debug_info. WASM files do not currently contain debug IDs (WebAssembly/tool-conventions#133).

Wherever a code address is used, it is the offset of an instruction relative within the Code section of the WebAssembly file. The DWARF is considered malformed if a PC offset is between instruction boundaries within the Code section. (See https://yurydelendik.github.io/webassembly-dwarf/#pc). Note that in browser stack traces the instruction offsets are absolute to the WASM file start (See https://webassembly.github.io/spec/web-api/index.html#conventions).

DW_TAG_namespace
  DW_AT_name                  lib1

  DW_TAG_subprogram
    DW_AT_low_pc                0x00000002
    DW_AT_high_pc               <offset-from-lowpc>9
    DW_AT_name                  calls_import1
    DW_AT_decl_file             0x00000001 /Users/jauer/Coding/wasm-test/lib1/src/lib.rs
    DW_AT_decl_line             0x00000008
    DW_AT_external              yes
  
  DW_TAG_subprogram
    DW_AT_low_pc                0x00000000
    DW_AT_high_pc               <offset-from-lowpc>35
    DW_AT_linkage_name          rust_begin_unwind
    DW_AT_name                  my_panic
    DW_AT_decl_file             0x00000001 /Users/jauer/Coding/wasm-test/lib1/src/lib.rs
    DW_AT_decl_line             0x0000000f
    DW_AT_noreturn              yes

    DW_TAG_formal_parameter
      DW_AT_location              len 0x0002: 910c: DW_OP_fbreg 12
      DW_AT_name                  _info
      DW_AT_decl_file             0x00000001 /Users/jauer/Coding/wasm-test/lib1/src/lib.rs
      DW_AT_decl_line             0x0000000f
      DW_AT_type                  0x000003dd<.debug_info+0x000003dd>

Browser Limitations

Browsers currently expose WASM in two ways. On the one hand through the limited WebAssembly API and on the other hand through the stack trace string.

The browser API exposes two objects when loading a web assembly module:

  • WebAssembly.Module: object representing the compiled WebAssembly module. This Module can be instantiated again or shared via postMessage().
  • WebAssembly.Instance: object that contains all the Exported WebAssembly functions.

Contents of the file can be accessed from the Module via three methods:

Neither object gives access to the full URI from which it was loaded, nor to the full contents. Browsers also do not offer an API to list or locate loaded wasm modules. While custom sections can be accessed if the WASM module handle is provided it is challenging to map a stack trace file name to a WASM module. Likely the solution would be to monkey patch the WASM loader or to ask users to register modules explicitly.

In Chrome 86, the stack trace for the above renders like this:

Error: whoops
    at crash (http://localhost:8088/index.js:1:9)
    at calls_import1 (http://localhost:8088/lib1.wasm:wasm-function[1]:0x86)
    at http://localhost:8088/index.js:15:5

Firefox observes similar output. Details of the second frame are:

  • calls_import1: Name of the wasm export function
  • http://localhost:8088/lib1.wasm: URI of the WASM module. We noticed that if two modules with identical contents are loaded, they always render the same URI of the first loaded module. This suggests that at least Chrome internally stores the URIs in an internal mapping.
  • wasm-function[1]: Indication of the WASM function. The number seems to be a 1-based index into the functions section of the WASM file.
  • 0x86: Byte offset into the WASM file where the function starts, relative to the start of the file.

Notes:

  • The URL field may be interpreted differently depending on the context. When the response-based instantiation API is used in a browser, the associated URL should be used; or when the ArrayBuffer-based instantiation API is used, the browser should represent the location of the API call. This kind of instantiation is analogous to executing JavaScript using eval; therefore if the browser has an existing method to represent the location of the eval call it can use a similar one for WebAssembly.instantiate.

  • The browser does not expose any function addresses or standard sections, so the start of the code section is hidden to SDKs. This means the most likely input for symbolic is the absolute address within the WASM file.

Proposed Next Steps

Based on the above investigation:

  • introduce the concept of a section offset to the DWARF code so that all instruction addresses are offset by the code section offset.
  • push for build_id custom sections to be added to files (WebAssembly/tool-conventions#133)
  • push for a browser API to map file names to WASM modules (or even provide build IDs directly in the stack trace string)

Build minidump with cc crate

Remove the makefile and build the C++ portion of symbolic-minidump with the cc crate (formerly gcc). It should support incremental builds and parallelism now, so all the reasons we used Makefiles are no longer valid.

`cargo test` is failing with last nightly

test test_elf_functions ... FAILED
test test_mach_functions ... FAILED
test test_elf_files ... FAILED
test test_elf_symbols ... FAILED
test test_mach_files ... FAILED
test test_mach_symbols ... FAILED
test test_pdb_symbols ... FAILED

The error is always the same:

thread 'test_elf_functions' panicked at 'attempted to leave type `base::Symbol` uninitialized, which is invalid', /home/calixte/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/mem/mod.rs:658:9

Compilation is failing when flag -Clink-dead-code is passed to rustc

In order to get code coverage, we pass -Clink-dead-code in RUSTFLAGS.
But swift demangler cpp code contains some unused and undefined functions.
Since cc automatically add -ffunction-sections, all the unused functions are stripped without -Clink-dead-code.
A way to reproduce it is to run RUSTFLAGS="-Clink-dead-code" cargo test in demangle dir.
The end of the output is:

...
,-Bdynamic" "-lstdc++" "-lutil" "-ldl" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld : /home/calixte/dev/mozilla/symbolic.calixteman/target/debug/deps/libsymbolic_demangle-4f42e003d6aaaf78.rlib(Context.o) : dans la fonction « swift::Demangle::Context::getModuleName[abi:cxx11](llvm::StringRef) » :
          /home/calixte/dev/mozilla/symbolic.calixteman/demangle/vendor/swift/lib/Demangling/Context.cpp:216 : référence indéfinie vers « swift::Demangle::isSpecialized(swift::Demangle::Node*) »
          /usr/bin/ld : /home/calixte/dev/mozilla/symbolic.calixteman/demangle/vendor/swift/lib/Demangling/Context.cpp:217 : référence indéfinie vers « swift::Demangle::getUnspecialized(swift::Demangle::Node*, swift::Demangle::NodeFactory&) »
          collect2: error: ld returned 1 exit status

Index out of range panic at src/libcore/slice/mod.rs:2413

Hi, we are having a rust panic crash with one of our binary files.
It happens with symbolic 6.1.3 and 6.1.4 and we are calling this from python with:

archive = symbolic.Archive.open(filename)
list(archive.iter_objects())  # it crashes on the third next() call on this iterable

Sharing the panic message below. I do not know any Rust so if you are missing any other info please say so and I will try to help.

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<console>", line 1, in <module>
  File "/home/appuser/.local/lib/python3.7/site-packages/symbolic/debuginfo.py", line 40, in iter_objects
    yield self._get_object(idx)
  File "/home/appuser/.local/lib/python3.7/site-packages/symbolic/debuginfo.py", line 61, in _get_object
    ptr = self._methodcall(lib.symbolic_archive_get_object, idx)
  File "/home/appuser/.local/lib/python3.7/site-packages/symbolic/utils.py", line 58, in _methodcall
    return rustcall(func, self._get_objptr(), *args)
  File "/home/appuser/.local/lib/python3.7/site-packages/symbolic/utils.py", line 93, in rustcall
    raise exc
symbolic.Panic: symbolic panicked: thread 'unnamed' panicked with 'index 9660037 out of range for slice of length 7340032' at src/libcore/slice/mod.rs:2413

stacktrace: stack backtrace:
   0: failure::backtrace::Backtrace::new::h8ada5e7dec1f1df0 (0x7f40621ea527)
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/internal.rs:44
      <failure::backtrace::Backtrace as core::default::Default>::default::h52408e978655c67d
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:125
   1: <T as core::convert::Into<U>>::into::h4de2394ec093dae3 (0x7f4062239404)
             at /root/.cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/error_impl.rs:19
      symbolic::utils::set_panic_hook::{{closure}}::h45f5cafd1f9528b0
             at src/utils.rs:83
   2: rust_panic_with_hook (0x7f40621f40a4)
             at src/libstd/panicking.rs:482
   3: continue_panic_fmt (0x7f40621f3dde)
             at src/libstd/panicking.rs:385
   4: rust_begin_unwind (0x7f40621ff795)
   5: panic_fmt (0x7f406220375b)
             at src/libcore/panicking.rs:85
   6: slice_index_len_fail (0x7f40622031e4)
             at src/libcore/slice/mod.rs:2413
   7: symbolic_debuginfo::macho::MachArchive::object_by_index::h3a50fa549059d24f (0x7f4062100cf7)
             at /rustc/6c2484dc3c532c052f159264e970278d8b77cdc9/src/libcore/slice/mod.rs:2590
      symbolic_debuginfo::object::Archive::object_by_index::h3df0ae4733c276a0
             at /work/debuginfo/src/object.rs:504
   8: symbolic_archive_get_object (0x7f40622287b4)
             at src/debuginfo.rs:64
   9: ffi_call_unix64 (0x7f40625efdef)
  10: ffi_call (0x7f40625ef857)
             at ../src/x86/ffi64.c:525
  11: cdata_call (0x7f4062812663)
             at c/_cffi_backend.c:3086
  12: PyObject_Call (0x7f406a11d8c3)
             at Objects/call.c:245
  13: do_call_core (0x7f406a18ec2b)
             at Python/ceval.c:4645
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3191
  14: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  15: _PyFunction_FastCallDict (0x7f406a11d173)
             at Objects/call.c:376
  16: do_call_core (0x7f406a18ec2b)
             at Python/ceval.c:4645
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3191
  17: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  18: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  19: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  20: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  21: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  22: gen_send_ex (0x7f406a122699)
             at Objects/genobject.c:221
      gen_iternext
             at Objects/genobject.c:542
  23: builtin_next (0x7f406a18b788)
             at Python/bltinmodule.c:1426
  24: _PyMethodDef_RawFastCallKeywords (0x7f406a11b9e2)
             at Objects/call.c:655
  25: _PyCFunction_FastCallKeywords (0x7f406a11b84f)
             at Objects/call.c:734
  26: call_function (0x7f406a192e65)
             at Python/ceval.c:4568
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  27: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  28: PyEval_EvalCodeEx (0x7f406a18b9b8)
             at Python/ceval.c:3959
  29: PyEval_EvalCode (0x7f406a18b97a)
             at Python/ceval.c:524
  30: builtin_exec_impl (0x7f406a205743)
             at Python/bltinmodule.c:1079
      builtin_exec
             at Python/clinic/bltinmodule.c.h:283
  31: _PyMethodDef_RawFastCallKeywords (0x7f406a11b9e2)
             at Objects/call.c:655
  32: _PyCFunction_FastCallKeywords (0x7f406a11b84f)
             at Objects/call.c:734
  33: call_function (0x7f406a192e65)
             at Python/ceval.c:4568
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  34: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  35: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  36: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  37: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  38: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  39: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  40: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  41: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  42: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  43: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  44: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  45: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  46: call_function (0x7f406a18d918)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3139
  47: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  48: call_function (0x7f406a18d03a)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  49: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  50: _PyFunction_FastCallDict (0x7f406a11d395)
             at Objects/call.c:376
  51: _PyObject_Call_Prepend (0x7f406a11d6a5)
             at Objects/call.c:908
  52: PyObject_Call (0x7f406a11d8c3)
             at Objects/call.c:245
  53: do_call_core (0x7f406a18ec2b)
             at Python/ceval.c:4645
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3191
  54: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  55: _PyFunction_FastCallDict (0x7f406a11d395)
             at Objects/call.c:376
  56: _PyObject_Call_Prepend (0x7f406a11d6a5)
             at Objects/call.c:908
  57: PyObject_Call (0x7f406a11d8c3)
             at Objects/call.c:245
  58: do_call_core (0x7f406a18ec2b)
             at Python/ceval.c:4645
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3191
  59: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  60: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  61: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  62: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  63: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  64: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  65: call_function (0x7f406a18d03a)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  66: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  67: PyEval_EvalCodeEx (0x7f406a18b9b8)
             at Python/ceval.c:3959
  68: PyEval_EvalCode (0x7f406a18b97a)
             at Python/ceval.c:524
  69: builtin_exec_impl (0x7f406a205743)
             at Python/bltinmodule.c:1079
      builtin_exec
             at Python/clinic/bltinmodule.c.h:283
  70: _PyMethodDef_RawFastCallKeywords (0x7f406a11b9e2)
             at Objects/call.c:655
  71: _PyCFunction_FastCallKeywords (0x7f406a11b84f)
             at Objects/call.c:734
  72: call_function (0x7f406a192e65)
             at Python/ceval.c:4568
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  73: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  74: PyEval_EvalCodeEx (0x7f406a18b9b8)
             at Python/ceval.c:3959
  75: PyEval_EvalCode (0x7f406a18b97a)
             at Python/ceval.c:524
  76: builtin_exec_impl (0x7f406a205743)
             at Python/bltinmodule.c:1079
      builtin_exec
             at Python/clinic/bltinmodule.c.h:283
  77: _PyMethodDef_RawFastCallKeywords (0x7f406a11b9e2)
             at Objects/call.c:655
  78: _PyCFunction_FastCallKeywords (0x7f406a11b84f)
             at Objects/call.c:734
  79: call_function (0x7f406a192e65)
             at Python/ceval.c:4568
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  80: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  81: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  82: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  83: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  84: call_function (0x7f406a18ce21)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3110
  85: function_code_fastcall (0x7f406a11c969)
             at Objects/call.c:283
      _PyFunction_FastCallKeywords
             at Objects/call.c:408
  86: call_function (0x7f406a190861)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3093
  87: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  88: PyEval_EvalCodeEx (0x7f406a18b9b8)
             at Python/ceval.c:3959
  89: PyEval_EvalCode (0x7f406a18b97a)
             at Python/ceval.c:524
  90: builtin_exec_impl (0x7f406a205743)
             at Python/bltinmodule.c:1079
      builtin_exec
             at Python/clinic/bltinmodule.c.h:283
  91: _PyMethodDef_RawFastCallKeywords (0x7f406a11b9e2)
             at Objects/call.c:655
  92: _PyCFunction_FastCallKeywords (0x7f406a11b84f)
             at Objects/call.c:734
  93: call_function (0x7f406a190703)
             at Python/ceval.c:4568
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  94: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  95: _PyFunction_FastCallKeywords (0x7f406a11ca11)
             at Objects/call.c:433
  96: call_function (0x7f406a18d03a)
             at Python/ceval.c:4616
      _PyEval_EvalFrameDefault
             at Python/ceval.c:3124
  97: _PyEval_EvalCodeWithName (0x7f406a18bcb0)
             at Python/ceval.c:3930
  98: _PyFunction_FastCallDict (0x7f406a11d1be)
             at Objects/call.c:376
  99: pymain_run_module (0x7f406a216a50)
             at Modules/main.c:320
 100: pymain_run_python (0x7f406a214975)
             at Modules/main.c:2864
      pymain_main
             at Modules/main.c:3028
 101: _Py_UnixMain (0x7f406a21460d)
             at Modules/main.c:3063
 102: __libc_start_main (0x7f4069c7e09a)
 103: _start (0x56544b0d6089)
 104: <unknown> (0x0)

Also is there any way to recover from the panic? I tried except symbolic.Panic but we still lose the parent process with a core dump.

Clarification or example for README bullet

There is a bullet in the README that drew me to this crate: "Generate Breakpad symbol files from Mach, ELF and PDBs" which would be perfect for something I am trying to accomplish. I am having trouble figuring out how to perform this generation though. Any chance someone could offer clarification and/or update the README with a more detailed explanation?

Support Breakpad symbols

Currently, only dwarf data can be processed by the stackwalker and symbolicator. However, our customers might wish to Breakpad symbols instead, as they have them already. In that case we should consider supporting those as well.

Invalid line size and extra line with version 7.3.0

I've this data in a so file:

Name: _ZN7mozilla14VolatileBufferD2Ev
Address: 0x4f44130
Size: 0x24
Line: LineInfo { address: 0x4f44130, size: 0x9, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 34 }
Line: LineInfo { address: 0x4f44139, size: 0x4, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 37 }
Line: LineInfo { address: 0x4f44142, size: 0x1e, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 38 }
Line: LineInfo { address: 0x4f44154, size: 0xc, file: FileInfo { name: "dist/include/mozilla/Mutex.h", dir: "/home/calixte/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu" }, line: 57 }
Inlinees:
  Name: _ZN7mozilla16OffTheBooksMutexD2Ev
  Address: 0x4f44142
  Size: 0x12
  Line: LineInfo { address: 0x4f44142, size: 0x1e, file: FileInfo { name: "dist/include/mozilla/Mutex.h", dir: "/home/calixte/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu" }, line: 57 }

Few bugs:
i) the sum of the lines size exceeds the function size (0x9+0x4+0x1e+0xc=0x37 > 0x24)
ii) this function contains an inlinee (at address 0x4f44142) and the line number in the main function is 38 when it's 57 in the inlinee
iii) there is a spurious line at 0x4f44154

With a previous version, I get:

Name: _ZN7mozilla14VolatileBufferD2Ev
Address: 0x4f44130
Size: 0x24
Line: LineInfo { address: 0x4f44130, size: 0x9, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 34 }
Line: LineInfo { address: 0x4f44139, size: 0x4, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 37 }
Line: LineInfo { address: 0x4f4413d, size: 0x5, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 37 }
Line: LineInfo { address: 0x4f44142, size: 0x1e, file: FileInfo { name: "memory/volatile/VolatileBufferFallback.cpp", dir: "/home/calixte/dev/mozilla/mozilla-central.hg" }, line: 38 }
Inlinees:
  Name: _ZN7mozilla16OffTheBooksMutexD2Ev
  Address: 0x4f44142
  Size: 0x12
  Line: LineInfo { address: 0x4f44142, size: 0x1e, file: FileInfo { name: "dist/include/mozilla/Mutex.h", dir: "/home/calixte/dev/mozilla/mozilla-central.hg/obj-x86_64-pc-linux-gnu" }, line: 57 }
  Inlinees:

@jan-auer fyi it's with the libxul.so I sent to you.

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.