def platformGetRegCtx(self, tid):
ctx = self.archGetRegCtx()
# NOTE: the tid *is* the port...
state = STRUCT_X86_THREAD_STATE64()
scount = ctypes.c_uint32(ctypes.sizeof(state) / 4)
ret = self.libc.thread_get_state(tid, x86_THREAD_STATE64, addrof(state), addrof(scount));
if ret != 0:
self.libc.mach_error("thread_get_state x86_THREAD_STATE64 failed:", ret)
raise Exception('thread_get_state (THREAD_STATE64) failed: 0x%.8x' % ret)
ctx._rctx_Import(state)
state = STRUCT_X86_DEBUG_STATE64()
scount = ctypes.c_uint32(ctypes.sizeof(state) / 4)
ret = self.libc.thread_get_state(tid, x86_DEBUG_STATE64, addrof(state), addrof(scount));
if ret != 0:
self.libc.mach_error("thread_get_state x86_DEBUG_STATE64 failed:", ret)
raise Exception('thread_get_state (DEBUG_STATE64) failed: 0x%.8x' % ret)
ctx._rctx_Import(state)
return ctx
评论列表
文章目录