JetBrains Fleet 1.42 Help

Attach to process

JetBrains Fleet provides a way to attach the debugger to both local and remote processes.

Prerequisites

The following prerequisites have to be met to enable full-fledged debugging:

Debug agent

Processes intended to allow debugger connections are started with the debug agent. Debug agent is a component of a host application that is responsible for communicating with the debugger. The communication happens over a socket connection, irrespective of whether the process is local or remote.

Start a process with the debug agent

  • When starting the process, add the following line to its VM options:

    -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005

    The option has the following parameters:

    • address – the port that will be used for debugging

    • server=y – specifies that the process should listen for incoming debugger connections (act as a server).

    • suspend – specifies whether the VM should wait until the debugger has connected or start executing the application's code immediately

    -agentlib:jdwp=transport=dt_socket,server=n,address=192.168.1.178:5005,suspend=y,onthrow=<FQ exception class name>,onuncaught=<y/n>

    The option has the following parameters:

    • address – the IP address and the port of the server end. Both IPv4 and IPv6 are supported.

    • server=n – specifies that the process should connect to the debugger (act as a client)

    • suspend=y – specifies that the VM should wait until the debugger has connected before executing the application code.

    • onthrow – optionally delays the connection until the specified exception is thrown. Use the exception's fully-qualified name as the value.

    • onuncaught – optionally delays the connection until an uncaught exception is thrown. Use the exception's fully-qualified name as the value.

    The format may differ depending on the JDK version.

Debug information

Debug information is a special kind of information in the application bytecode. The debugger uses this information to identify local variables, line numbers, and so on. The bytecode of an application may or may not have debugging information included.

The debug information is provided to the program at compile-time. This is controlled with the -g compiler flag. By default, the compiler includes most of the information required for debugging, but if it was not you, who compiled the application, it may happen that the program that you are going to debug was compiled without this information.

Application sources

You have to have the sources of the application you are debugging. JetBrains Fleet matches debugging events with the sources and displays information relevant to the debugging session in the editor. This allows you to view the debugging session as if it was the source code that is being executed.

Attach to a process

  1. Press ⌘ ⇧ K and start typing Attach to Process. Select Attach to Process.

  2. Choose from the suggested local processes or enter the host and port of the application you want to attach to. For example: 192.168.1.5:5005

Last modified: 24 October 2024