コード例 #1
0
 def attach(self, pid):
     self.running = True
     self.pid = pid
     self.task = debug.task_for_pid(self.pid)
     self.is64 = debug.is_64_bit(self.pid)
     debug.ptrace_attach(pid)
     status = os.waitpid(self.pid, 0)[1]
     self.running = False
コード例 #2
0
 def start(self, args):
     assert self.pid is None, "already tracing a program."
     self.running = True
     self.pid = os.fork()
     if self.pid:
         status = os.waitpid(self.pid, 0)[1]
         self.task = debug.task_for_pid(self.pid)
         self.is64 = debug.is_64_bit(self.pid)
         self.running = False
     else:
         debug.ptrace_trace_me()
         os.execv(args[0], args)