def OnDblClick(self, node_id): is_thread, value, label = self[node_id] if is_thread: ida_dbg.select_thread(value) self.Show() s = "SEH chain for " + hex(value) t = "-" * len(s) print(t) print(s) print(t) for handler in self.result[value]: print("%x: %s" % (handler, self.names[handler])) print(t) else: ida_kernwin.jumpto(value) return True
def main(): if not ida_idd.dbg_can_query(): print("The debugger must be active and suspended before using this script!") return # Save current thread id tid = ida_dbg.get_current_thread() # Iterate through all function instructions and take only call instructions result = {} for tid in idautils.Threads(): result[tid] = GetExceptionChain(tid) # Restore previously selected thread ida_dbg.select_thread(tid) # Build the graph g = SEHGraph("SEH graph", result) g.Show()
def GetFsBase(tid): ida_dbg.select_thread(tid) base = ida_idd.dbg_get_thread_sreg_base(tid, idautils.cpu.fs) if base != 0: return base return WindbgGetRegBase(tid)