如何调试Java应用程序,无需访问源代码? [英] How to debug a Java application without access to the source code?

查看:543
本文介绍了如何调试Java应用程序,无需访问源代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要调试我没有源代码的Java应用程序。它在Jetty服务器上本地运行。使用JD-GUI进行解码工作正常。通过套接字连接或共享内存连接JDB也可以正常工作。



我失败的地方加入了这些部分。我主要使用JD-Eclipse插件和远程调试来尝试Eclipse。我没有找到一种方法来成功地将调试器附加到正在运行的进程。一切似乎都假设我至少有部分应用程序可用作项目的源代码,但我没有。而且它是一个非常大的应用程序(200多个MiB的JAR文件和500+ MiB的其他东西),所以试图从所有反编译的类中构建一个项目,让它运行不是一个选项,除非它很容易自动化。 / p>

我真正需要的是可以将调试器附加到正在运行的进程中,查看并导航反编译代码,设置断点和检查变量和对象。代码可以重新编译无关紧要。条件断点和表达式评估将是很好的。

解决方案

你可以通过jd- eclipse及其扩展jd-eclipse重新调整片段。



JD-Eclipse



重新排列片段



安装此过程非常简单:




  • 按照$中提供的步骤安装 JD-Eclipse b $ b JD-Eclipse网站(过程很简单)

  • 重新启动Eclipse

  • 下载重新对齐realignment.jd.ide.eclipse_1.0.2.jar

  • 将文件复制到\dropins

  • 重新启动Eclipse

  • 转到Windows - >首选项

  • 导航到常规 - >编辑器 - >文件关联

  • 选择*在文件类型部分中的.class中,在关联编辑器部分中选择重新对齐JD
    类文件编辑器,然后单击
    默认按钮。

  • 按确定并开始调试!


I need to debug a Java application I have no source code for. It is running locally on a Jetty server. Decompiling using JD-GUI works fine. Attaching JDB via a socket connection or shared memory works fine, too.

Where I fail is joining the pieces together. I mainly tried Eclipse with the JD-Eclipse plugin and remote debugging. I failed to find a way to successfully attach the debugger to a running process. Everything seems to assume that I have at least parts of the application available as source code in a project, but I have not. And it is quite a large application (200+ MiB of JAR files and 500+ MiB of other stuff) so trying to build a project from all the decompiled classes and getting this to run is not an option unless it is easy to automate.

What I really need is being able to attach a debugger to a running process, see and navigate the decompiled code, set breakpoints and inspect variables and objects. It does not matter if the code could be recompiled. Conditional breakpoints and expression evaluation would be nice to have.

解决方案

You can probably do this with the help of a combination of jd-eclipse and its extension jd-eclipse realignment fragment.

JD-Eclipse

Realignment fragment

The process for installing this is quite simple:

  • Install JD-Eclipse following the steps provided in the JD-Eclipse site (the process is quite simple)
  • Restart Eclipse
  • Download Realignment realignment.jd.ide.eclipse_1.0.2.jar
  • Copy the file to the \dropins
  • Restart Eclipse
  • Go to Windows -> Preferences
  • Navigate to General -> Editors -> File Associations
  • Select *.class in the File types section, select Realignment for JD Class File Editor in the Associated editors section and click the Default button.
  • Press OK and start debugging!

这篇关于如何调试Java应用程序,无需访问源代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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