Debug and forward ports on a host
此内容尚不支持你的语言。
In a remote project the debugger and the program both run on the host. The debug messages travel inside the project’s encrypted session, so no debug port is opened on your computer. A web server you start on the host can be forwarded to your computer’s loopback address and opened in your browser. Remote debugging is In progress; port forwarding is Experimental.
- Debug in the windowDebug, ⌃⇧D or a run marker asks the backend for the plan of the configuration.
- Trust on the hostA launch runs project code, so the host project must be trusted.If not: Refused with the trust message; attaching still works.
- Adapter on the hostThe backend starts the debug adapter on the host, over its standard input and output or a private socket in a 0700 folder.
- Session streamDebug messages pass unchanged through the SSH or paired session.
- Debug tool windowBreakpoints, stepping, variables, evaluation and hot swap work as for a local program.
Debug a program on the host
Section titled “Debug a program on the host”- Open the remote project and set breakpoints in its files as usual.
- Start the configuration with Debug in the toolbar, ⌃⇧D, or the Debug item of a run marker in the gutter.
- The Debug tool window opens. Stop, Rerun, stepping, variables, evaluation, Set Value, watches and Java hot swap work as in a local session.
The adapters are those installed on the host: lldb-dap, debugpy, kotlin-debug-adapter, js-debug,
Delve and java-debug (inside the host’s jdtls). The language_servers tool and each language guide
name the install command. Stops in project files open the file through the session with the caret
on the line; frames outside the project show their host path in the call stack and open nothing
here.
Attach to a process, a container or a pod on the host
Section titled “Attach to a process, a container or a pod on the host”Run › Attach to Process… (⌥⇧F5) in a remote project lists the processes of your account on the host. Instead of picking one you can type a target:
| You type | Attaches to |
|---|---|
host:port |
a debug server at that address, as the host sees it (127.0.0.1:5678) |
docker:<container>:<port> |
a container on the host, through the port it publishes on the host’s loopback address |
pod:[<namespace>/]<pod>:<port> |
a pod, through kubectl port-forward --address 127.0.0.1 started on the host |
Add =<folder in the target> to map sources, for example docker:api:5678=/app; a container’s bind
mounts give the mapping on their own. The adapter runs on the host and connects from there, so the
target needs no port on your computer.
A container port published on all interfaces is not used: publish it on 127.0.0.1 instead
(-p 127.0.0.1:5678:5678). An address other than the host’s loopback is your explicit entry
only, and the Debug console says that the traffic between the host and that address is not
protected by Ferris IDEA.
When the connection breaks during a debug session
Section titled “When the connection breaks during a debug session”The Debug console shows Reconnecting…. The adapter keeps running on the host and keeps the last 1 MiB of what it sent; after the resume the session continues with no message lost or repeated. If more than that came during the break, or the adapter ended, the session ends with a message instead of guessing.
Forward a port to your computer
Section titled “Forward a port to your computer”When a program started from a host terminal or run listens on a TCP port, the window offers it: a notification Port 8080 on host: Forward, and a row in Services › Ports.
- Choose Forward in the notification or on the row.
- Your computer listens on
127.0.0.1(and[::1]) on the same port number when it is free, or on a free one; the row shows both. - Open in Browser opens it. Stop Forwarding closes the local listener and its connections. All forwards close with the project window.
What is forwarded and what is not:
- Only to the loopback address. No setting binds a forward to another interface.
- Debug ports are never forwarded. A port of a debug adapter or a program it started (JDWP, debugpy, lldb-server, gdbserver, the Node.js inspector, Delve) allows running code, so it has no Forward button and is refused with debug ports are reached by the debugger through the session.
- Database ports ask first. For 5432, 3306, 1433, 1521, 6379 and 27017 the window warns that other users of your computer can reach a forwarded port and forwards only after you confirm. The database tools reach a host database through the session without a forward.
- Nothing is forwarded on the host’s request. A forward starts only from your click or from
an agent you granted the right
ports.
When it does not work
Section titled “When it does not work”| Message | What to do |
|---|---|
| not available on this backend | The backend on the host is older than the window and lacks the debug or port functions. Update it as the SSH guide says. |
| The trust message on Debug | Trust the host project (the banner’s Trust Project), or attach instead of launching. |
| not supported on this platform yet | js-debug, Delve and Java debugging on a Windows host need a private channel that does not exist there yet. |
| A port published on all interfaces | Publish the container’s debug port on 127.0.0.1. |
For agents
Section titled “For agents”remote_debug_start and remote_debug_attach start a session on an open remote project
(dry run by default, the right debug otherwise); the session then answers to the usual debug_*
tools. An agent may name only loopback addresses for attach and forwards, and cannot confirm the
database warning.
remote_debug_attachAttach a debugger to a process, a debug port, a container or a pod of an open remote project's host (SPEC-0322, Experimental).remote_debug_startDebug a run configuration (or the run marker at doc+line) of an open remote project on its host (SPEC-0322, Experimental): the adapter runs on the host, nothing opens a port here.remote_port_closeClose a port forward of a remote project (SPEC-0318, Experimental): the local listener stops and the host side closes its connections.remote_port_forwardForward a port of an open remote project's host to this computer (SPEC-0318, Experimental): the local end listens on 127.0.0.1 only (same port number when free), each connection goes through the encrypted session to 127.0.0.1 on the host.remote_portsPorts of an open remote project (SPEC-0318, Experimental): the TCP ports that programs started on the host by its terminals and runs listen on (port, address, program, kind:service,debugordatabase) and the forwards open now with their local loopback address.
No tool matches. Try fewer words, or .