MCPcopy Create free account
hub / github.com/ELMERIKH/PyinMemoryPE / _handle_exception_breakpoint

Method _handle_exception_breakpoint

windows/debug/debugger.py:539–582  ·  view source on GitHub ↗
(self, exception, excp_addr)

Source from the content-addressed store, hash-verified

537
538
539 def _handle_exception_breakpoint(self, exception, excp_addr):
540 excp_bitness = self.get_exception_bitness(exception)
541 YOLO = False
542 if self.current_thread.context.EEFlags.TF:
543 dbgprint("Single step as begin of _handle_exception_breakpoint", "DBG")
544 # import pdb;pdb.set_trace()
545 YOLO = True
546
547 # Sub-method _do_setup() ?
548 dbg_has_setup = None
549 if not self.first_bp_encoutered:
550 dbg_has_setup = not getattr(self.on_setup, "_abstract_on_setup_", False)
551 self.first_bp_encoutered = True
552 if dbg_has_setup:
553 with self.DisabledMemoryBreakpoint():
554 continue_flag = self.on_setup() # Handle single-step here ?
555 # Check killed in action ?
556 # What if setup + BP object() ?
557 if excp_addr in self.breakpoints[self.current_process.pid]:
558 thread = self.current_thread
559 if self.current_process.bitness == 32 and excp_bitness == 64:
560 ctx = thread.context_syswow
561 else:
562 ctx = thread.context
563 ctx.pc -= 1
564 if self.current_process.bitness == 32 and excp_bitness == 64:
565 thread.set_syswow_context(ctx)
566 else:
567 thread.set_context(ctx)
568 del thread
569 continue_flag = self._dispatch_breakpoint(exception, excp_addr)
570 if self._killed_in_action():
571 return continue_flag
572 self._explicit_single_step[self.current_thread.tid] = self.current_thread.context.EEFlags.TF and not YOLO
573 if self._explicit_single_step[self.current_thread.tid]:
574 dbgprint("Someone ask for an explicit Single step", "DBG")
575 if excp_addr in self.breakpoints[self.current_process.pid]:
576 # Setup BP if not suppressed
577 self._pass_breakpoint(excp_addr)
578 return continue_flag
579 if dbg_has_setup: # setup() was called on this BP-event: no on_exception()
580 return continue_flag
581 with self.DisabledMemoryBreakpoint():
582 return self.on_exception(exception)
583
584 def _handle_exception_singlestep(self, exception, excp_addr):
585 if self.current_thread.tid in self._breakpoint_to_reput and self._breakpoint_to_reput[self.current_thread.tid]:

Callers 1

_handle_exceptionMethod · 0.95

Calls 9

get_exception_bitnessMethod · 0.95
on_setupMethod · 0.95
_dispatch_breakpointMethod · 0.95
_killed_in_actionMethod · 0.95
_pass_breakpointMethod · 0.95
on_exceptionMethod · 0.95
set_syswow_contextMethod · 0.80
set_contextMethod · 0.45

Tested by

no test coverage detected