Jdwp options in Debug Mode
已回答
when i run my program in debug mode, the comand line jdwp protocol param (server) was set to n(like below), can this be set to y?
\bin\java.exe -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:2453,suspend=y,
server=n
version: IntelliJ IDEA 2023.2.2 (Ultimate Edition)
appreciated for your reply!
请先登录再写评论。
It can be set to y, see: https://www.jetbrains.com/help/idea/tutorial-remote-debug.html#debugger_rc
set to n as it will act as a debugger client.
Some explanation:
To debug an application remotely, you will have to set options like:
-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4242. This allows remote debuggers (jdb even ships with JDK) to attach to a running Java process.There are two flavors of transports:
dt_socketanddt_shmem. Thedt_shmemoption only works in case both processes are running on the same platform and is only available on Windows.With
suspend=ythe Java-process will wait until the debugger connects, withsuspend=nyou will be also able to debug the application servers startup process.The option
server=yopens a socket and listens for incoming debugger requests. Withserver=nthe debugged application will try to connect actively to a debugger and run therefore as a client.So there is no black magic involved in debugging application servers. As long they are implemented in Java, you will be always able to debug them. Even without any fancy tools.
See "official" list of all available remote debugging options: http://docs.oracle.com/javase/1.5.0/docs/guide/jpda/conninv.html
thans for your anwser!
refer to the toturial:https://www.jetbrains.com/help/idea/tutorial-remote-debug.html#debugger_rc, i add vm options: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005, then i can connect to the debug server using jdb tool.
however, it seems that it's only worked when i click the run button to run my program. when i click the debug run button to run my program, the options added seems to be overridden, is this correct?
When you click the debug button in IDE, it assumes you are using IDEA's local debug function.
As described here: https://www.jetbrains.com/help/idea/2023.2/debugging-code.html