(self, exc)
| 114 | return self.handle_exception(exc) |
| 115 | |
| 116 | def handle_exception(self, exc): |
| 117 | exp_code = self.get_exception_code() |
| 118 | context = self.get_exception_context() |
| 119 | exp_addr = context.pc |
| 120 | if exp_code == EXCEPTION_BREAKPOINT and exp_addr in self.breakpoints: |
| 121 | res = self.breakpoints[exp_addr].trigger(self, exc) |
| 122 | single_step = self.get_exception_context().EEFlags.TF # single step activated by breakpoint |
| 123 | if exp_addr in self.breakpoints: # Breakpoint deleted itself ? |
| 124 | return self._pass_breakpoint(exp_addr, single_step) |
| 125 | return EXCEPTION_CONTINUE_EXECUTION |
| 126 | |
| 127 | if exp_code == EXCEPTION_SINGLE_STEP and windows.current_thread.tid in self._reput_breakpoint: |
| 128 | bp, single_step = self._reput_breakpoint[windows.current_thread.tid] |
| 129 | self._memory_save[bp._addr] = windows.current_process.read_memory(bp._addr, 1) |
| 130 | with windows.utils.VirtualProtected(bp._addr, 1, PAGE_EXECUTE_READWRITE): |
| 131 | windows.current_process.write_memory(bp._addr, b"\xcc") |
| 132 | del self._reput_breakpoint[windows.current_thread.tid] |
| 133 | if single_step: |
| 134 | return self.on_exception(exc) |
| 135 | return windef.EXCEPTION_CONTINUE_EXECUTION |
| 136 | elif exp_code == EXCEPTION_SINGLE_STEP and exp_addr in self._hxbp_breakpoint[windows.current_thread.tid]: |
| 137 | res = self._hxbp_breakpoint[windows.current_thread.tid][exp_addr].trigger(self, exc) |
| 138 | context.EEFlags.RF = 1 |
| 139 | return EXCEPTION_CONTINUE_EXECUTION |
| 140 | return self.on_exception(exc) |
| 141 | |
| 142 | def on_exception(self, exc): |
| 143 | """Called on exception""" |
no test coverage detected