MCPcopy Create free account
hub / github.com/fabioz/PyDev.Debugger / set_context

Method set_context

pydevd_attach_to_process/winappdbg/thread.py:554–597  ·  view source on GitHub ↗

Sets the values of the registers. @see: L{get_context} @type context: dict( str S{->} int ) @param context: Dictionary mapping register names to their values. @type bSuspend: bool @param bSuspend: C{True} to automatically suspend the thread befo

(self, context, bSuspend=False)

Source from the content-addressed store, hash-verified

552 return ctx
553
554 def set_context(self, context, bSuspend=False):
555 """
556 Sets the values of the registers.
557
558 @see: L{get_context}
559
560 @type context: dict( str S{->} int )
561 @param context: Dictionary mapping register names to their values.
562
563 @type bSuspend: bool
564 @param bSuspend: C{True} to automatically suspend the thread before
565 setting its context, C{False} otherwise.
566
567 Defaults to C{False} because suspending the thread during some
568 debug events (like thread creation or destruction) may lead to
569 strange errors.
570
571 Note that WinAppDbg 1.4 used to suspend the thread automatically
572 always. This behavior was changed in version 1.5.
573 """
574
575 # Get the thread handle.
576 dwAccess = win32.THREAD_SET_CONTEXT
577 if bSuspend:
578 dwAccess = dwAccess | win32.THREAD_SUSPEND_RESUME
579 hThread = self.get_handle(dwAccess)
580
581 # Suspend the thread if requested.
582 if bSuspend:
583 self.suspend()
584 # No fix for the exit process event bug.
585 # Setting the context of a dead thread is pointless anyway.
586
587 # Set the thread context.
588 try:
589 if win32.bits == 64 and self.is_wow64():
590 win32.Wow64SetThreadContext(hThread, context)
591 else:
592 win32.SetThreadContext(hThread, context)
593
594 # Resume the thread if we suspended it.
595 finally:
596 if bSuspend:
597 self.resume()
598
599 def get_register(self, register):
600 """

Callers 9

set_registerMethod · 0.95
set_pcMethod · 0.95
set_spMethod · 0.95
set_fpMethod · 0.95
set_flagsMethod · 0.95
change_registerMethod · 0.80
__clear_bpMethod · 0.80
__set_bpMethod · 0.80
_notify_single_stepMethod · 0.80

Calls 4

get_handleMethod · 0.95
suspendMethod · 0.95
is_wow64Method · 0.95
resumeMethod · 0.95

Tested by

no test coverage detected