Calls the debug event notify callbacks. @see: L{cont}, L{loop}, L{wait} @type event: L{Event} @param event: (Optional) Event object returned by L{wait}. @raise WindowsError: Raises an exception on error.
(self, event=None)
| 839 | return event |
| 840 | |
| 841 | def dispatch(self, event=None): |
| 842 | """ |
| 843 | Calls the debug event notify callbacks. |
| 844 | |
| 845 | @see: L{cont}, L{loop}, L{wait} |
| 846 | |
| 847 | @type event: L{Event} |
| 848 | @param event: (Optional) Event object returned by L{wait}. |
| 849 | |
| 850 | @raise WindowsError: Raises an exception on error. |
| 851 | """ |
| 852 | |
| 853 | # If no event object was given, use the last event. |
| 854 | if event is None: |
| 855 | event = self.lastEvent |
| 856 | |
| 857 | # Ignore dummy events. |
| 858 | if not event: |
| 859 | return |
| 860 | |
| 861 | # Determine the default behaviour for this event. |
| 862 | # XXX HACK |
| 863 | # Some undocumented flags are used, but as far as I know in those |
| 864 | # versions of Windows that don't support them they should behave |
| 865 | # like DGB_CONTINUE. |
| 866 | |
| 867 | code = event.get_event_code() |
| 868 | if code == win32.EXCEPTION_DEBUG_EVENT: |
| 869 | # At this point, by default some exception types are swallowed by |
| 870 | # the debugger, because we don't know yet if it was caused by the |
| 871 | # debugger itself or the debugged process. |
| 872 | # |
| 873 | # Later on (see breakpoint.py) if we determined the exception was |
| 874 | # not caused directly by the debugger itself, we set the default |
| 875 | # back to passing the exception to the debugee. |
| 876 | # |
| 877 | # The "invalid handle" exception is also swallowed by the debugger |
| 878 | # because it's not normally generated by the debugee. But in |
| 879 | # hostile mode we want to pass it to the debugee, as it may be the |
| 880 | # result of an anti-debug trick. In that case it's best to disable |
| 881 | # bad handles detection with Microsoft's gflags.exe utility. See: |
| 882 | # http://msdn.microsoft.com/en-us/library/windows/hardware/ff549557(v=vs.85).aspx |
| 883 | |
| 884 | exc_code = event.get_exception_code() |
| 885 | if exc_code in ( |
| 886 | win32.EXCEPTION_BREAKPOINT, |
| 887 | win32.EXCEPTION_WX86_BREAKPOINT, |
| 888 | win32.EXCEPTION_SINGLE_STEP, |
| 889 | win32.EXCEPTION_GUARD_PAGE, |
| 890 | ): |
| 891 | event.continueStatus = win32.DBG_CONTINUE |
| 892 | elif exc_code == win32.EXCEPTION_INVALID_HANDLE: |
| 893 | if self.__bHostileCode: |
| 894 | event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED |
| 895 | else: |
| 896 | event.continueStatus = win32.DBG_CONTINUE |
| 897 | else: |
| 898 | event.continueStatus = win32.DBG_EXCEPTION_NOT_HANDLED |
no test coverage detected