Ejemplo n.º 1
0
def get_bpt(adr):
    """
    :param adr: the bp address
    :return: the bpt_t object of the breakpoint in the address
    """
    bpt = idaapi.bpt_t()
    idaapi.get_bpt(adr, bpt)
    return bpt
Ejemplo n.º 2
0
 def set(self, break_p=False):
     #print "breakpoint on %08x" % self.address
     idaapi.add_bpt(self.address, 0, idc.BPT_SOFT)
     idaapi.enable_bpt(self.address, True)
     #idc.SetBptCnd(self.address, self.condition.get_text())
     bpt = idaapi.bpt_t()
     idaapi.get_bpt(self.address, bpt)
     bpt.elang = self.elang
     bpt.condition = self.condition.get_text()
     idaapi.update_bpt(bpt)
Ejemplo n.º 3
0
	def SetHandlerBreakpoint(self, address):
		'''
		Sets a handler breakpoint on the specified address.

		@address - Address to set the breakpoint at.

		Returns True on success, False on failure.
		'''
		# Some remote debugger stubs have special needs for different architectures (e.g., gdb).
		# Thus, setting breakpoints should be done through the architecture abstraction class, 
		# rather than directly through AddBpt/AddBptEx.
		self.cpu.SetBreakpoint(address)

		# A bug in versions of IDAPython shipped with IDA prior to 6.4sp1 improperly interpreted 
		# the is_lowcnd value set via SetBptCnd/SetBptCndEx. Do this directly through idaapi
		# ourselves in order to support older versions.
		bpt = idaapi.bpt_t()
		idaapi.get_bpt(address, bpt)
		bpt.condition = self.bpt_cnd
		bpt.flags &= ~idc.BPT_LOWCND
		return idaapi.update_bpt(bpt)
Ejemplo n.º 4
0
    def SetHandlerBreakpoint(self, address):
        '''
		Sets a handler breakpoint on the specified address.

		@address - Address to set the breakpoint at.

		Returns True on success, False on failure.
		'''
        # Some remote debugger stubs have special needs for different architectures (e.g., gdb).
        # Thus, setting breakpoints should be done through the architecture abstraction class,
        # rather than directly through AddBpt/AddBptEx.
        self.cpu.SetBreakpoint(address)

        # A bug in versions of IDAPython shipped with IDA prior to 6.4sp1 improperly interpreted
        # the is_lowcnd value set via SetBptCnd/SetBptCndEx. Do this directly through idaapi
        # ourselves in order to support older versions.
        bpt = idaapi.bpt_t()
        idaapi.get_bpt(address, bpt)
        bpt.condition = self.bpt_cnd
        bpt.flags &= ~idc.BPT_LOWCND
        return idaapi.update_bpt(bpt)
Ejemplo n.º 5
0
def Breakpoints():
    count = GetBptQty()
    for i in range(0, count):
        ea = GetBptEA(i)
        bpt = idaapi.bpt_t()
        if not idaapi.get_bpt(ea, bpt):
            continue
        if bpt.type & BPT_SOFT != 0:
            yield (ea, BPNORMAL, 0, Word(ea))
        else:
            bptype = BPNORMAL if bpt.type == BPT_DEFAULT else BPHARDWARE
            hwtype = {
                BPT_WRITE: UE_HARDWARE_WRITE,
                BPT_RDWR: UE_HARDWARE_READWRITE,
                BPT_EXEC: UE_HARDWARE_EXECUTE
            }[bpt.type]
            hwsize = {
                1: UE_HARDWARE_SIZE_1,
                2: UE_HARDWARE_SIZE_2,
                4: UE_HARDWARE_SIZE_4,
                8: UE_HARDWARE_SIZE_8,
            }[bpt.size]
            yield (ea, bptype, (hwtype << 4 | hwsize), 0)
Ejemplo n.º 6
0
 def elang(self):
     bpt = idaapi.bpt_t()
     if not idaapi.get_bpt(self.addr, bpt):
         return False
     return bpt.elang
Ejemplo n.º 7
0
 def _set_elang(self, elang):
     bpt = idaapi.bpt_t()
     if not idaapi.get_bpt(self.addr, bpt):
         return False
     bpt.elang = elang
     return idaapi.update_bpt(bpt)