Пример #1
0
def attach(address, redirect_output=True, log_dir=None):
    """Attaches this process to the debugger listening on a given address.

    Parameters
    ----------
    address : (str, int), optional
        Specifies the interface and port on which the debugger is listening
        for TCP connections. It is in the same format as used for
        regular sockets of the `socket.AF_INET` family, i.e. a tuple of
        ``(hostname, port)``.
    redirect_output : bool, optional
        Specifies whether any output (on both `stdout` and `stderr`) produced
        by this program should be sent to the debugger. Default is ``True``.
    log_dir : str, optional
        Name of the directory that debugger will create its log files in.
        If not specified, logging is disabled.
    """

    if log_dir:
        ptvsd.options.log_dir = log_dir
    ptvsd.log.to_file()
    ptvsd.log.info('attach{0!r}', (address, redirect_output))

    if is_attached():
        ptvsd.log.info('attach() ignored - already attached.')
        return

    debugger_attached.clear()

    # Ensure port is int
    port = address[1]
    address = (address[0], port if type(port) is int else int(port))

    ptvsd_attach(address, redirect_output=redirect_output)
Пример #2
0
def attach(address, redirect_output=True):
    """Attaches this process to the debugger listening on a given address.

    Parameters
    ----------
    address : (str, int), optional
        Specifies the interface and port on which the debugger is listening
        for TCP connections. It is in the same format as used for
        regular sockets of the `socket.AF_INET` family, i.e. a tuple of
        ``(hostname, port)``.
    redirect_output : bool, optional
        Specifies whether any output (on both `stdout` and `stderr`) produced
        by this program should be sent to the debugger. Default is ``True``.
    """
    if is_attached():
        return
    debugger_attached.clear()

    # Ensure port is int
    port = address[1]
    address = (address[0], port if type(port) is int else int(port))

    global _attach_port
    _attach_port = address[1]

    ptvsd_attach(address, redirect_output=redirect_output)
Пример #3
0
def attach(address, redirect_output=True, log_dir=None):
    """Attaches this process to the debugger listening on a given address.

    Parameters
    ----------
    address : (str, int), optional
        Specifies the interface and port on which the debugger is listening
        for TCP connections. It is in the same format as used for
        regular sockets of the `socket.AF_INET` family, i.e. a tuple of
        ``(hostname, port)``.
    redirect_output : bool, optional
        Specifies whether any output (on both `stdout` and `stderr`) produced
        by this program should be sent to the debugger. Default is ``True``.
    log_dir : str, optional
        Name of the directory that debugger will create its log files in.
        If not specified, logging is disabled.
    """

    if log_dir:
        ptvsd.options.log_dir = log_dir
    ptvsd.log.to_file()
    ptvsd.log.info('attach{0!r}', (address, redirect_output))

    if is_attached():
        ptvsd.log.info('attach() ignored - already attached.')
        return

    debugger_attached.clear()

    # Ensure port is int
    port = address[1]
    address = (address[0], port if type(port) is int else int(port))

    ptvsd_attach(address, redirect_output=redirect_output)
Пример #4
0
def attach(address, redirect_output=True):
    """Attaches this process to the debugger listening on a given address.

    Parameters
    ----------
    address : (str, int), optional
        Specifies the interface and port on which the debugger is listening
        for TCP connections. It is in the same format as used for
        regular sockets of the `socket.AF_INET` family, i.e. a tuple of
        ``(hostname, port)``.
    redirect_output : bool, optional
        Specifies whether any output (on both `stdout` and `stderr`) produced
        by this program should be sent to the debugger. Default is ``True``.
    """
    if is_attached():
        return
    debugger_attached.clear()

    # Ensure port is int
    port = address[1]
    address = (address[0], port if type(port) is int else int(port))

    ptvsd_attach(address, redirect_output=redirect_output)