#NEWLINE# def setBreakpoint( self , addr , type = Target . BREAKPOINT_AUTO ) : #NEWLINE# #INDENT# logging . debug ( 'set bkpt type %d at 0x%x' , type , addr ) #NEWLINE# addr = ( addr & ( ~ 1 ) ) #NEWLINE# bp = self . findBreakpoint ( addr ) #NEWLINE# if ( bp is not None ) : #NEWLINE# #INDENT# return True #NEWLINE# #UNINDENT# region = self . memory_map . getRegionForAddress ( addr ) #NEWLINE# if ( region is None ) : #NEWLINE# #INDENT# return False #NEWLINE# #UNINDENT# if ( type == Target . BREAKPOINT_AUTO ) : #NEWLINE# #INDENT# if ( ( addr >= 536870912 ) or region . isRam or ( self . availableBreakpoint ( ) == 0 ) ) : #NEWLINE# #INDENT# type = Target . BREAKPOINT_SW #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# type = Target . BREAKPOINT_HW #NEWLINE# #UNINDENT# logging . debug ( 'using type %d for auto bp' , type ) #NEWLINE# #UNINDENT# if ( ( type == Target . BREAKPOINT_HW ) and ( addr >= 536870912 ) ) : #NEWLINE# #INDENT# logging . debug ( 'using sw bp instead because of unsupported addr' ) #NEWLINE# type = Target . BREAKPOINT_SW #NEWLINE# #UNINDENT# if region . isFlash : #NEWLINE# #INDENT# logging . debug ( 'using hw bp instead because addr is flash' ) #NEWLINE# type = Target . BREAKPOINT_HW #NEWLINE# #UNINDENT# if ( type == Target . BREAKPOINT_HW ) : #NEWLINE# #INDENT# return self . setHardwareBreakpoint ( addr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( type == Target . BREAKPOINT_SW ) : #NEWLINE# #INDENT# return self . setSoftwareBreakpoint ( addr ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raise RuntimeError ( ( 'Unknown breakpoint type %d' % type ) )