BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / python / #3489同步于 2014/9/24
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Python机器人发帖

一个奇怪的问题

xsc
2014/9/24镜像同步2 回复
刚学python。。。水平很菜,这里面有一个循环: if snapshot is not None: thread_entry.dwSize = sizeof(thread_entry) success=kernel32.Thread32First(snapshot,byref(thread_entry)) while success: #print ("OwnerProcessID:%d",thread_entry.th32OwnerProcessID) #print ("fuck") if thread_entry.th32OwnerProcessID == self.pid: print ("*****ThreadID:",thread_entry.th32ThreadID) thread_list.append(thread_entry.th32ThreadID) else: print ("False ThreadID:",thread_entry.th32ThreadID) success = kernel32.Thread32Next(snapshot, byref(thread_entry)) kernel32.CloseHandle(snapshot) return thread_list else : print "CreateToolhelp32Snapshot false" return False 我的调试代码是: pid = raw_input("Enter a PID of the Process to attach to: ") debugger.attach(int(pid)) thread_list = debugger.enumerate_threads() if len(thread_list)==0: print "thread_list is none" for thread in thread_list: thread_context = debugger.get_thread_context(thread) print "[*] Dumping registers for thread ID: 0x%08x"%thread print "[**] RAX: 0x%016x"%thread_context.Rax print "[**] RCX: 0x%016x"%thread_context.Rcx print "[**] RDX: 0x%016x"%thread_context.Rdx print "[**] RBX: 0x%016x"%thread_context.Rbx print "[**] RSI: 0x%016x"%thread_context.Rsi print "[**] RDI: 0x%016x"%thread_context.Rdi print "[**] RSP: 0x%016x"%thread_context.Rsp print "[**] RBP: 0x%016x"%thread_context.Rbp print "[*] END DUMP" debugger.detach() raw_input("end \n") 这样写没问题输出是这样的: Enter a PID of the Process to attach to: 4660 ('False ThreadID:', 0L) ('False ThreadID:', 0L) ... ('False ThreadID:', 4208L) ('False ThreadID:', 5400L) ('False ThreadID:', 3448L) the h_thread is 0x00000248 [*] Dumping registers for thread ID: 0x00001710 [**] RAX: 0x0000000000000000 [**] RCX: 0x00007ff9a6f80cd0 [**] RDX: 0x0000000000000000 [**] RBX: 0x000000000023fce0 [**] RSI: 0x0000000000000000 但是注释掉else,list就变空了。。。 Enter a PID of the Process to attach to: 4660 thread_list is none [*] Finished debugging. Exiting... end 为什么唉??求教了
订阅后,新回复会通过你的通知中心匿名送达。
2 条回复
reverland机器人#1 · 2014/9/29
咦,设快照的调试器么 来自「北邮人论坛手机版」
xsc机器人#2 · 2014/12/18
【 在 reverland 的大作中提到: 】 : 咦,设快照的调试器么 : 来自「北邮人论坛手机版」 是的!!!!!!!