parameters: (self)
return_statement: return continue_status
docstring: This is the default EXCEPTION_BREAKPOINT handler, responsible for transparently restoring soft breakpoints
          and passing control to the registered user callback handler.
  
          @rtype:  DWORD
          @return: Debug event continue status.
docstring_summary: This is the default EXCEPTION_BREAKPOINT handler, responsible for transparently restoring soft breakpoints
          and passing control to the registered user callback handler.
docstring_tokens: This is the default EXCEPTION_BREAKPOINT handler responsible for transparently restoring soft breakpoints and passing control to the registered user callback handler .
function: def exception_handler_breakpoint (self):
          '''
          This is the default EXCEPTION_BREAKPOINT handler, responsible for transparently restoring soft breakpoints
          and passing control to the registered user callback handler.
  
          @rtype:  DWORD
          @return: Debug event continue status.
          '''
  
          self._log("pydbg.exception_handler_breakpoint() at %08x from thread id %d" % (self.exception_address, self.dbg.dwThreadId))
  
          # breakpoints we did not set.
          if not self.bp_is_ours(self.exception_address):
              # system breakpoints.
              if self.exception_address == self.system_break:
                  # pass control to user registered call back.
                  if self.callbacks.has_key(EXCEPTION_BREAKPOINT):
                      continue_status = self.callbacks[EXCEPTION_BREAKPOINT](self)
                  else:
                      continue_status = DBG_CONTINUE
  
                  if self.first_breakpoint:
                      self._log("first windows driven system breakpoint at %08x" % self.exception_address)
                      self.first_breakpoint = False
  
              # ignore all other breakpoints we didn't explicitly set.
              else:
                  self._log("breakpoint not ours %08x" % self.exception_address)
                  continue_status = DBG_EXCEPTION_NOT_HANDLED
  
          # breakpoints we did set.
          else:
              # restore the original byte at the breakpoint address.
              self._log("restoring original byte at %08x" % self.exception_address)
              self.write_process_memory(self.exception_address, self.breakpoints[self.exception_address].original_byte)
              self.set_attr("dirty", True)
  
              # before we can continue, we have to correct the value of EIP. the reason for this is that the 1-byte INT 3
              # we inserted causes EIP to "slide" + 1 into the original instruction and must be reset.
              self.set_register("EIP", self.exception_address)
              self.context.Eip -= 1
  
              # if there is a specific handler registered for this bp, pass control to it.
              if self.breakpoints[self.exception_address].handler:
                  self._log("calling user handler")
                  continue_status = self.breakpoints[self.exception_address].handler(self)
  
              # pass control to default user registered call back handler, if it is specified.
              elif self.callbacks.has_key(EXCEPTION_BREAKPOINT):
                  continue_status = self.callbacks[EXCEPTION_BREAKPOINT](self)
  
              else:
                  continue_status = DBG_CONTINUE
  
              # if the breakpoint still exists, ie: the user didn't erase it during the callback, and the breakpoint is
              # flagged for restore, then tell the single step handler about it. furthermore, check if the debugger is
              # still active, that way we don't try and single step if the user requested a detach.
              if self.get_attr("debugger_active") and self.breakpoints.has_key(self.exception_address):
                  if self.breakpoints[self.exception_address].restore:
                      self._restore_breakpoint = self.breakpoints[self.exception_address]
                      self.single_step(True)
  
                  self.bp_del(self.exception_address)
  
          return continue_status
function_tokens: def exception_handler_breakpoint ( self ) : self . _log ( "pydbg.exception_handler_breakpoint() at %08x from thread id %d" % ( self . exception_address , self . dbg . dwThreadId ) ) # breakpoints we did not set. if not self . bp_is_ours ( self . exception_address ) : # system breakpoints. if self . exception_address == self . system_break : # pass control to user registered call back. if self . callbacks . has_key ( EXCEPTION_BREAKPOINT ) : continue_status = self . callbacks [ EXCEPTION_BREAKPOINT ] ( self ) else : continue_status = DBG_CONTINUE if self . first_breakpoint : self . _log ( "first windows driven system breakpoint at %08x" % self . exception_address ) self . first_breakpoint = False # ignore all other breakpoints we didn't explicitly set. else : self . _log ( "breakpoint not ours %08x" % self . exception_address ) continue_status = DBG_EXCEPTION_NOT_HANDLED # breakpoints we did set. else : # restore the original byte at the breakpoint address. self . _log ( "restoring original byte at %08x" % self . exception_address ) self . write_process_memory ( self . exception_address , self . breakpoints [ self . exception_address ] . original_byte ) self . set_attr ( "dirty" , True ) # before we can continue, we have to correct the value of EIP. the reason for this is that the 1-byte INT 3 # we inserted causes EIP to "slide" + 1 into the original instruction and must be reset. self . set_register ( "EIP" , self . exception_address ) self . context . Eip -= 1 # if there is a specific handler registered for this bp, pass control to it. if self . breakpoints [ self . exception_address ] . handler : self . _log ( "calling user handler" ) continue_status = self . breakpoints [ self . exception_address ] . handler ( self ) # pass control to default user registered call back handler, if it is specified. elif self . callbacks . has_key ( EXCEPTION_BREAKPOINT ) : continue_status = self . callbacks [ EXCEPTION_BREAKPOINT ] ( self ) else : continue_status = DBG_CONTINUE # if the breakpoint still exists, ie: the user didn't erase it during the callback, and the breakpoint is # flagged for restore, then tell the single step handler about it. furthermore, check if the debugger is # still active, that way we don't try and single step if the user requested a detach. if self . get_attr ( "debugger_active" ) and self . breakpoints . has_key ( self . exception_address ) : if self . breakpoints [ self . exception_address ] . restore : self . _restore_breakpoint = self . breakpoints [ self . exception_address ] self . single_step ( True ) self . bp_del ( self . exception_address ) return continue_status