IntelliJ IDEA调试器跟随子进程 [英] IntelliJ IDEA debugger follow child process

查看:863
本文介绍了IntelliJ IDEA调试器跟随子进程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一些Java代码,使用以下代码启动一个新进程: Runtime.getRuntime()。exec(command); 我希望能够告诉调试器它应该遵循子进程,就像你可以使用GDB set follow-fork-mode child 命令

We have some Java code that starts a new process using the following code: Runtime.getRuntime().exec(command); I'd like to be able to tell the debugger that it should follow the child process like you can do with GDB as documented here by issuing the set follow-fork-mode child command.

在IntelliJ IDEA Java调试器中相当的东西?如果是这样配置的话?

Is there something equivalent in the IntelliJ IDEA Java debugger? If so how do I configure it?

谢谢

推荐答案

不提供调试进程及其子进程的自动化方式。需要使用JVM选项运行子进程以启用调试。 IDEA 远程调试配置将建议使用正确的选项。一旦通过适当的选项启动该过程,您可以使用远程调试配置从IDEA连接到它。

Java doesn't provide an automated way to debug processes and their child processes. One needs to run the child process with the JVM options to enable debugging. IDEA Remote Debug configuration will suggest the proper options to use. Once the process is started with the appropriate options you can connect to it from IDEA with the Remote Debug configuration.

示例选项:

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

您可能需要以 suspend = y 开始,以便执行暂停,直到您连接调试器。

You may want to start with suspend=y so that the execution is suspended until you connect with the debugger.

这篇关于IntelliJ IDEA调试器跟随子进程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆