def setup_buf_bpt(ptr, n, enable): for i in range(n): u = ptr + i if enable: idc.AddBptEx(u, 1, idc.BPT_RDWR) else: idc.DelBpt(u)
def __init__(self, addr, size=None): if size is None: size = self.BP_SIZE self.addr = addr if idc.CheckBpt(self.addr) != idc.BPTCK_NONE: raise ValueError("There is already a breakpoint at {0}".format(hex(self.addr))) if not idc.AddBptEx(addr, size, self.BP_TYPE): raise ValueError("Failed to create breakpoint at {0}".format(hex(self.addr))) self._set_elang("Python") self._set_condition("return breakpoint.all_breakpoint[{0}].trigger()".format(self.addr)) all_breakpoint[self.addr] = self
def SetBreakpoint(self, address): ''' Some GDB stubs for various architectures require different breakpoint settings. This method sets the appropriate breakpoint for the selected architecture. @address - The breakpoint address. Returns True on success, False on failure. ''' bpt_size = 0 bpt_type = idc.BPT_SOFT if self.cpu.has_key('bpt_size'): bpt_size = self.cpu['bpt_size'] if self.cpu.has_key('bpt_type'): bpt_type = self.cpu['bpt_type'] return idc.AddBptEx(address, bpt_size, bpt_type)