コード例 #1
0
    def make_thread_suspend_single_notification(self, py_db, thread_id, stop_reason):
        exc_desc = None
        exc_name = None
        if stop_reason in self._STEP_REASONS:
            stop_reason = 'step'
        elif stop_reason in self._EXCEPTION_REASONS:
            stop_reason = 'exception'
        elif stop_reason == CMD_SET_BREAK:
            stop_reason = 'breakpoint'
        elif stop_reason == CMD_SET_NEXT_STATEMENT:
            stop_reason = 'goto'
        else:
            stop_reason = 'pause'

        if stop_reason == 'exception':
            exception_info_response = build_exception_info_response(
                py_db, thread_id, -1, set_additional_thread_info, self._iter_visible_frames_info, max_frames=-1)
            exception_info_response

            exc_name = exception_info_response.body.exceptionId
            exc_desc = exception_info_response.body.description

        body = pydevd_schema.StoppedEventBody(
            reason=stop_reason,
            description=exc_desc,
            threadId=thread_id,
            text=exc_name,
            allThreadsStopped=True,
            preserveFocusHint=stop_reason not in ['step', 'exception', 'breakpoint'],
        )
        event = pydevd_schema.StoppedEvent(body)
        return NetCommand(CMD_THREAD_SUSPEND_SINGLE_NOTIFICATION, 0, event, is_json=True)
    def make_thread_suspend_single_notification(self, py_db, thread_id,
                                                stop_reason):
        exc_desc = None
        exc_name = None
        thread = pydevd_find_thread_by_id(thread_id)
        info = set_additional_thread_info(thread)

        preserve_focus_hint = False
        if stop_reason in self._STEP_REASONS:
            if info.pydev_original_step_cmd == CMD_STOP_ON_START:

                # Just to make sure that's not set as the original reason anymore.
                info.pydev_original_step_cmd = -1
                stop_reason = 'entry'
            else:
                stop_reason = 'step'
        elif stop_reason in self._EXCEPTION_REASONS:
            stop_reason = 'exception'
        elif stop_reason == CMD_SET_BREAK:
            stop_reason = 'breakpoint'
        elif stop_reason == CMD_SET_FUNCTION_BREAK:
            stop_reason = 'function breakpoint'
        elif stop_reason == CMD_SET_NEXT_STATEMENT:
            stop_reason = 'goto'
        else:
            stop_reason = 'pause'
            preserve_focus_hint = True

        if stop_reason == 'exception':
            exception_info_response = build_exception_info_response(
                py_db,
                thread_id,
                -1,
                set_additional_thread_info,
                self._iter_visible_frames_info,
                max_frames=-1)
            exception_info_response

            exc_name = exception_info_response.body.exceptionId
            exc_desc = exception_info_response.body.description

        body = pydevd_schema.StoppedEventBody(
            reason=stop_reason,
            description=exc_desc,
            threadId=thread_id,
            text=exc_name,
            allThreadsStopped=True,
            preserveFocusHint=preserve_focus_hint,
        )
        event = pydevd_schema.StoppedEvent(body)
        return NetCommand(CMD_THREAD_SUSPEND_SINGLE_NOTIFICATION,
                          0,
                          event,
                          is_json=True)
コード例 #3
0
    def make_thread_suspend_single_notification(self, py_db, thread_id,
                                                stop_reason):
        exc_desc = None
        exc_name = None
        thread = pydevd_find_thread_by_id(thread_id)
        info = set_additional_thread_info(thread)

        if stop_reason in self._STEP_REASONS:
            if info.pydev_stop_on_entry:
                stop_reason = 'entry'
            else:
                stop_reason = 'step'
        elif stop_reason in self._EXCEPTION_REASONS:
            stop_reason = 'exception'
        elif stop_reason == CMD_SET_BREAK:
            stop_reason = 'breakpoint'
        elif stop_reason == CMD_SET_NEXT_STATEMENT:
            stop_reason = 'goto'
        else:
            stop_reason = 'pause'

        # At this point we are stopped. This should be false going forward.
        info.pydev_stop_on_entry = False

        if stop_reason == 'exception':
            exception_info_response = build_exception_info_response(
                py_db,
                thread_id,
                -1,
                set_additional_thread_info,
                self._iter_visible_frames_info,
                max_frames=-1)
            exception_info_response

            exc_name = exception_info_response.body.exceptionId
            exc_desc = exception_info_response.body.description

        body = pydevd_schema.StoppedEventBody(
            reason=stop_reason,
            description=exc_desc,
            threadId=thread_id,
            text=exc_name,
            allThreadsStopped=True,
            preserveFocusHint=stop_reason
            not in ['step', 'exception', 'breakpoint', 'entry'],
        )
        event = pydevd_schema.StoppedEvent(body)
        return NetCommand(CMD_THREAD_SUSPEND_SINGLE_NOTIFICATION,
                          0,
                          event,
                          is_json=True)