# 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
        ptr = self._get_ptr()
        count = _ffi.new('int *')
        arr = rustcall(_lib.debug_info_get_variants, ptr, count)
        return [Variant(arr[x]) for x in range(count[0])]

    def get_variant(self, uuid_or_cpu_name):
        if isinstance(uuid_or_cpu_name, uuid.UUID):
            id = uuid_or_cpu_name
            cpu_name = None
        else:
            try:
                id = uuid.UUID(uuid_or_cpu_name)
                cpu_name = None
            except ValueError:
                id = None
                cpu_name = uuid_or_cpu_name
        for variant in self.get_variants():
            if (id is not None and variant.uuid == id) or \
               (cpu_name is not None and variant.cpu_name == cpu_name):
                return variant

    def close(self):
        if self._ptr:
            _lib.debug_info_free(self._ptr)
        self._ptr = None

    def __del__(self):
        try:
            self.close()
        except Exception:

# 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

        ptr = self._get_ptr()
        count = _ffi.new('int *')
        arr = rustcall(_lib.debug_info_get_variants, ptr, count)
        return [Variant(arr[x]) for x in range(count[0])]

    def get_variant(self, uuid_or_cpu_name):
        if isinstance(uuid_or_cpu_name, uuid.UUID):
            id = uuid_or_cpu_name
            cpu_name = None
        else:
            try:
                id = uuid.UUID(uuid_or_cpu_name)
                cpu_name = None
            except ValueError:
                id = None
                cpu_name = uuid_or_cpu_name
        for variant in self.get_variants():
            if (id is not None and variant.uuid == id) or \
               (cpu_name is not None and variant.cpu_name == cpu_name):
                return variant

    def close(self):
        if self._ptr:
            _lib.debug_info_free(self._ptr)
        self._ptr = None

    def __del__(self):
        try:
            self.close()
        except Exception:

            pass