简体   繁体   English

我可以从Eclipse / IDE调试器连接到远程机器上的jsadebugd进程吗?

[英]Can I connect to a jsadebugd process on a remote machine from Eclipse/IDE debugger?

I have a java process running on a Linux box, but it cannot be started/re-started in debug mode. 我有一个在Linux机器上运行的java进程,但它无法在调试模式下启动/重新启动。 I read about the jsadebugd command and started the daemon, but I want to connect to it from an IDE(possibly Eclipse) debugger or maybe YourKit or jconsole. 我阅读了jsadebugd命令并启动了守护程序,但我想从IDE(可能是Eclipse)调试器或者YourKit或jconsole连接到它。 How can I do this? 我怎样才能做到这一点? The remote JVM is 1.6+. 远程JVM是1.6+。

I assume since you mentioned Yourkit and other tool that what you really want to do is look at object state inside your applications. 我假设您提到了Yourkit和其他工具,您真正想要做的是查看应用程序中的对象状态。 There are a couple of options, though I don't think it gets you the ability to set break-points like Eclipse or another debugger would (though I'd be intersted in hearing what restricts you from starting the process in debug mode - technical? process?) 有几个选项,虽然我认为它不会让你能够设置像Eclipse或其他调试器那样的断点(虽然我会听到什么限制你在调试模式下启动进程 - 技术?过程?)

  1. have you tried connecting with: VisualVM ? 你试过连接: VisualVM I don't believe you need to start in debug mode, and it will give you the ability to navigate the object graph, and inspect objects. 我不相信您需要在调试模式下启动,它将使您能够导航对象图并检查对象。 You can even use it to take heapdumps and do some ad-hoc analysis through them using OQL queries. 您甚至可以使用它来获取堆转储并使用OQL查询通过它们进行一些临时分析。

  2. If you're running on JDK6+ - have you tried instrumenting with btrace? 如果您在JDK6 +上运行 - 您是否尝试使用btrace进行检测? Some notes from the sailfin team sounded promising, and like DTrace in Solaris, this seem like it would be useful in a variety of situations. 来自sailfin团队的一些注释听起来很有希望,就像Solaris中的DTrace一样,这似乎在各种情况下都很有用。

I am not sure if I understand your restrictions correctly but you can start JVM with debugging server (serving JDWP) enabled. 我不确定我是否正确理解了您的限制,但您可以启用JVM并启用调试服务器(提供JDWP)。 See for example "Sun VM Invocation Options" in http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html 请参阅http://java.sun.com/j2se/1.4.2/docs/guide/jpda/conninv.html中的 “Sun VM调用选项”示例

Then you can connect your Eclipse debugger to running JVM. 然后,您可以将Eclipse调试器连接到正在运行的JVM。 See "Remote debugging" section here http://www.ibm.com/developerworks/library/os-ecbug/ 请参阅http://www.ibm.com/developerworks/library/os-ecbug/中的 “远程调试”部分

I'm not sure that this is exposed by Eclipse, but here's how to do it with jdb: 我不确定这是否暴露在Eclipse中,但是这里是如何用jdb做的:

http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/tooldescr.html#gbmog http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/tooldescr.html#gbmog

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

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