def test_get_subtype(self):
        ctypes = types.reset_ctypes()

        class X(ctypes.Structure):
            _fields_ = [('p', ctypes.POINTER(ctypes.c_long))]
        PX = ctypes.POINTER(X)
        self.assertEquals(utils.get_subtype(PX), X)

        ctypes = types.reload_ctypes(4, 4, 8)  # different arch

        class Y(ctypes.Structure):
            _fields_ = [('p', ctypes.POINTER(ctypes.c_long))]
        PY = ctypes.POINTER(Y)
        self.assertEquals(utils.get_subtype(PY), Y)
Exemple #2
0
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

import logging

log = logging.getLogger("gbd")

from haystack import types
import ctypes

if hasattr(ctypes, "proxy"):
    types.reset_ctypes()

import platform

if platform.system() != "Windows":
    # ptrace debugguer
    import ptrace.debugger.debugger  # import PtraceDebugger

    PtraceDebugger = ptrace.debugger.debugger.PtraceDebugger
    # proc mapping
    from ptrace.debugger import process_error

    ProcessError = process_error.ProcessError
    import ptrace.os_tools  # import HAS_PROC

    if ptrace.os_tools.HAS_PROC: