# Path: symsynd/exceptions.py
# class SymbolicationError(Exception):
# class DebugInfoError(SymbolicationError):
# class DwarfLookupError(DebugInfoError):
# class NoSuchArch(DwarfLookupError):
# class NoSuchSection(DwarfLookupError):
# class NoSuchAttribute(DwarfLookupError):
#     def __init__(self, message):
#     def __str__(self):
#     def __unicode__(self):
# 
# Path: symsynd/_compat.py
# PY2 = sys.version_info[0] == 2
# def to_bytes(x):


import os
import uuid
from symsynd import exceptions
from symsynd._debug import ffi as _ffi
from symsynd._compat import to_bytes, text_type

    def __init__(self):
        raise TypeError('Cannot instanciate debug infos')

    @staticmethod
    def _from_ptr(ptr):
        rv = object.__new__(DebugInfo)
        rv._ptr = ptr
        return rv

    @staticmethod
    def open_path(path):
        di = rustcall(_lib.debug_info_open_path, to_bytes(path))
        return DebugInfo._from_ptr(di)

    def _get_ptr(self):
        if self._ptr is None:
            raise RuntimeError('Debug info closed')
        return self._ptr

    def get_compilation_dir(self, cpu_name, path):
        ptr = self._get_ptr()

        try:
            rv = rustcall(_lib.debug_info_get_compilation_dir,
                          ptr, to_bytes(cpu_name), to_bytes(path))
            rv = _ffi.string(rv)
            if isinstance(path, text_type):
                rv = rv.decode('utf-8')
            return rv

# Path: symsynd/exceptions.py
# class SymbolicationError(Exception):
# class DebugInfoError(SymbolicationError):
# class DwarfLookupError(DebugInfoError):
# class NoSuchArch(DwarfLookupError):
# class NoSuchSection(DwarfLookupError):
# class NoSuchAttribute(DwarfLookupError):
#     def __init__(self, message):
#     def __str__(self):
#     def __unicode__(self):
# 
# Path: symsynd/_compat.py
# PY2 = sys.version_info[0] == 2
# def to_bytes(x):


# Path: symsynd/libdebug.py
import os
import uuid
from symsynd import exceptions
from symsynd._debug import ffi as _ffi
from symsynd._compat import to_bytes, text_type


    def __init__(self):
        raise TypeError('Cannot instanciate debug infos')

    @staticmethod
    def _from_ptr(ptr):
        rv = object.__new__(DebugInfo)
        rv._ptr = ptr
        return rv

    @staticmethod
    def open_path(path):
        di = rustcall(_lib.debug_info_open_path, to_bytes(path))
        return DebugInfo._from_ptr(di)

    def _get_ptr(self):
        if self._ptr is None:
            raise RuntimeError('Debug info closed')
        return self._ptr

    def get_compilation_dir(self, cpu_name, path):
        ptr = self._get_ptr()

        try:
            rv = rustcall(_lib.debug_info_get_compilation_dir,
                          ptr, to_bytes(cpu_name), to_bytes(path))
            rv = _ffi.string(rv)
            if isinstance(path, text_type):
                rv = rv.decode('utf-8')
            return rv

        except exceptions.DwarfLookupError: