Remote Debbuging
What is remote debbuging and why is it useful?
Remote Debugging allows to debug the program running on another system as long we have access to the source code and debugger port is present on the system running the application.
Step by step
We can attach our debugger to remote program in a few simple steps:
Check if remote debbuging port is open
Remember that application has to be run in the debugging mode in order to connect our debbuger.
Debug mode in Java applications (LOCAL):
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=[PORT] -jar ~/[PROGRAM].jar
Fully Remote with wildcard:
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:[PORT] -jar [PROGRAM].jar
Download the code related to the program
You have to get the source code of the application that you want to debug. It does not need to be ready to run as long as we only want to remote debug the program.
Create launch.json
In the Debbuger part in VSCode the option for creating the configuration file will show up.

After creating it, inside we should add "[Programming language] Attach to Remote Program option"

In the body of the template we have to specify hostname and port on which debbuging port is turned on.
Select Attach to Remote Program option
In the Run and Debug panel you have to check the following option:

Run the debugger
Right now the debugger should work and the selected breakpoints should trigger when interacting with the application.
Last updated