Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Python #253

Open
ArekPiekarz opened this issue Jul 7, 2020 · 1 comment
Open

Documentation for Python #253

ArekPiekarz opened this issue Jul 7, 2020 · 1 comment

Comments

@ArekPiekarz
Copy link

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?

@jan-auer
Copy link
Member

jan-auer commented Jul 8, 2020

You're right, the Python documentation is currently very insufficient. Until we catch up with this, you can have a look at this test for an example of how to symbolicate:

archive = Archive.open(path)
obj = archive.get_object(arch="x86_64")
symcache = obj.make_symcache()
# Make sure our stream starts with the header
stream = symcache.open_stream()
assert stream.read(4) == b"SYMC"
# Make s symcache from the entire thing
stream = symcache.open_stream()
cache = SymCache.from_bytes(stream.read())
# Verify a known symbol
symbol = cache.lookup(0x107BB9F25 - 0x107BB9000)[0]
assert symbol.symbol == "main"

It's worth pointing out that symbolic does not help you to locate the files. You need a separate system to search them on your machine, potentially by loading a path pointed to in the crash, or by consulting a symbol server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants