简体   繁体   English

自动附加Eclipse调试器

[英]Automatically attach Eclipse debugger

Is there a way to automatically attach the Eclipse debugger when my app starts? 当我的应用启动时,是否可以自动附加Eclipse调试器?

I need to debug code that happens just as my process launches so it's difficult to attach the Eclipse debugger in time. 我需要调试过程启动时发生的代码,因此很难及时附加Eclipse调试器。

Perhaps a similar method to Debug.waitForDebugger() in JDK (not Android)? 也许与JDK(不是Android)中的Debug.waitForDebugger()类似的方法?

In JVM DEBUG parameters there is a parameter called "suspend" which takes value as "y" or "n". 在JVM DEBUG参数中,有一个名为“ suspend”的参数,该参数的值为“ y”或“ n”。 so if you want to debug the process from start set this parameter as "suspend=y" and your Java application will wait until Eclipse remotely connect to it. 因此,如果您要从头开始调试过程,请将此参数设置为“ suspend = y”,您的Java应用程序将等待Eclipse远程连接到它。

Otherwise if you want to run your program and later want eclipse to be connected that set this as "suspend=n" so your java application will run normally and after eclipse remotely connected to it, it will stop on breakpoints. 否则,如果您要运行程序并稍后要连接eclipse,请将其设置为“ suspend = n”,以便您的Java应用程序可以正常运行,并且在eclipse远程连接到它之后,它将在断点处停止。

Read more: http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html#ixzz3x15ZQaIh 了解更多: http : //javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html#ixzz3x15ZQaIh

-agentlib:jdwp=transport=dt_socket,server=y, suspend=y ,address=5000 -agentlib:jdwp = transport = dt_socket,server = y, suspend = y ,地址= 5000

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM