对于 Eclipse 来说,有什么比 jad 更准确​​的反编译器来消除 <-MISALIGNED -> 呢?

发布于 2024-09-18 05:17:24 字数 1472 浏览 6 评论 0 原文

我使用 jad 已经很多年了,其中大部分都与 eclipse 的 Jadclipse 插件一起使用,这使得它非常有用。特别是使用“对齐代码进行调试”,它允许您查看堆栈跟踪中任何行的反编译代码。很不错。

不幸的是,我已经看到越来越多的 <- MISALIGNED -> 。注释潜入其中,这很可能是因为 jad 期望类文件按顺序排列,而 Java 6 运行时库的情况显然并非如此。因此,当写入文件时,一条指令说“这是第 100 行”,那么会写入 99 个空行,如果下一条指令说“这是第 10 行”,那么 jad 无法倒回以将该输出放在那里,而只是打印发表评论说这是在错误的地方。

以下是 HttpURLConnection 的示例:

          protected HttpURLConnection(URL url, Proxy proxy, Handler handler1)
            {
/* <-MISALIGNED-> */ /* 603*/        super(url);
/* <-MISALIGNED-> */ /* 192*/        ps = null;
/* <-MISALIGNED-> */ /* 196*/        errorStream = null;
/* <-MISALIGNED-> */ /* 199*/        setUserCookies = true;
/* <-MISALIGNED-> */ /* 200*/        userCookies = null;
/* <-MISALIGNED-> */ /* 220*/        currentProxyCredentials = null;
/* <-MISALIGNED-> */ /* 221*/        currentServerCredentials = null;
/* <-MISALIGNED-> */ /* 222*/        needToCheck = true;
/* <-MISALIGNED-> */ /* 223*/        doingNTLM2ndStage = false;
/* <-MISALIGNED-> */ /* 224*/        doingNTLMp2ndStage = false;
/* <-MISALIGNED-> */ /* 226*/        tryTransparentNTLMServer = NTLMAuthentication.supportsTransparentAuth();
/* <-MISALIGNED-> */ /* 227*/        tryTransparentNTLMProxy = NTLMAuthentication.supportsTransparentAuth();
/

现在的问题是是否有另一个反编译器可以按行生成更准确的输出。实际的反编译不需要非常出色或任何东西,但我真的很喜欢它出现在 Java Stack Trace 视图所期望的位置。如果它与 Jadclipse 配合得很好,那就更好了。

I have used jad for many years, most of these with the Jadclipse plugin to eclipse which makes it quite usable. Especially with the "Align code for debugging" which allows you to see the decompiled code for any line in a stack trace. Very nice.

Unfortunately I've seen more and more that the <- MISALIGNED -> comment sneaks in, which is most likely because jad expects the classfile to be in order which clearly is not the case for the Java 6 runtime library. Hence when writing the file, and an instruction says "this is line 100" then 99 empty lines are written, and if then the next instruction says "this is for line 10" then jad cannot rewind to put that output there, but just prints out a comment that this is in the wrong place.

Here is an example for HttpURLConnection:

          protected HttpURLConnection(URL url, Proxy proxy, Handler handler1)
            {
/* <-MISALIGNED-> */ /* 603*/        super(url);
/* <-MISALIGNED-> */ /* 192*/        ps = null;
/* <-MISALIGNED-> */ /* 196*/        errorStream = null;
/* <-MISALIGNED-> */ /* 199*/        setUserCookies = true;
/* <-MISALIGNED-> */ /* 200*/        userCookies = null;
/* <-MISALIGNED-> */ /* 220*/        currentProxyCredentials = null;
/* <-MISALIGNED-> */ /* 221*/        currentServerCredentials = null;
/* <-MISALIGNED-> */ /* 222*/        needToCheck = true;
/* <-MISALIGNED-> */ /* 223*/        doingNTLM2ndStage = false;
/* <-MISALIGNED-> */ /* 224*/        doingNTLMp2ndStage = false;
/* <-MISALIGNED-> */ /* 226*/        tryTransparentNTLMServer = NTLMAuthentication.supportsTransparentAuth();
/* <-MISALIGNED-> */ /* 227*/        tryTransparentNTLMProxy = NTLMAuthentication.supportsTransparentAuth();
/

The question is now if there is another decompiler which generates more accurate output linewise. The actual decompilation does not need to be extremely great or anything, but I really like it to be where the Java Stack Trace view expects it to be. If it works well with Jadclipse, thats even better.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

盛夏尉蓝 2024-09-25 05:17:24

调试格式的问题来自 jadclipse 而不是 jadjad 不具备该功能。

jadclipse 插件在类名 DebugAlignWriter 中有一个小代码部分,它执行以下操作:

if((align = getAlignTarget(aLine)) != -1)
{
   if(align < curLine)
   {
      if(curLine != 0)
      {
          out.write(10);
      }
      out.write("/* <-MISALIGNED-> */ ");
      out.write(aLine);
      curLine++;
   }
   else if(align == curLine)
   {
      out.write(aLine);
   }
   else
   {
      for(; align > curLine; curLine++)
      {
          out.write(10);
      }
      out.write(aLine);
   }

}

基本上它会尝试对齐 jad 的输出。

所以根本原因是 jad 产生的输出不一定按照读取顺序。不幸的是,我无法解释为什么 jad 会这样做。根据 jad 帮助,无法控制顺序。

我在 jadclipse 中注意到,如果您设置 JadClipse->Formatting->Don't insert a newline before opening brax - 它会减少 /* <-MISALIGNED-> 的数量*/ 由于其工作方式的性质而分段。

此外,如果您选中了方法之前的输出字段选项,它可能会增加 /* <-MISALIGNED-> 的数量。 */ 段,所以避免它。

The problem with formatting for debug comes from jadclipse and not from jad. jad does not have that capability.

The jadclipse plug-in has a little code section in a class names DebugAlignWriter which does this:

if((align = getAlignTarget(aLine)) != -1)
{
   if(align < curLine)
   {
      if(curLine != 0)
      {
          out.write(10);
      }
      out.write("/* <-MISALIGNED-> */ ");
      out.write(aLine);
      curLine++;
   }
   else if(align == curLine)
   {
      out.write(aLine);
   }
   else
   {
      for(; align > curLine; curLine++)
      {
          out.write(10);
      }
      out.write(aLine);
   }

}

Basically it tries to align the output from jad.

So the root cause is that jad produces an output that is not necessarily in reading order. Unfortunately I cannot shed light on why jad acts that way. According to jad help there is no way of controlling the order.

I noticed in jadclipse that if you set JadClipse->Formatting->Don't insert a newline before opening brace - it will reduce the number of /* <-MISALIGNED-> */ segments due to the nature of how it works.

Also, if you checked the Output fields before methods option it can increase the number of /* <-MISALIGNED-> */ segments, so avoid it.

无名指的心愿 2024-09-25 05:17:24

JD-Eclipse 是一个非常好的反编译器,它还可以处理 java 7 功能。

它还没有“对齐代码以进行调试”功能,但我自己添加了一个。我去年一直在使用它。

当线路需要向后移动时,我也会处理这些情况;我仍然将其标记为 MISALIGNED 以表示特殊情况,但至少它放置在正确的行上。

如果有人想尝试一下,可以从此处。 README.txt 中有更多详细信息

JD-Eclipse is a very good decompiler which also handles java 7 features.

It doesn't have an "Align code for debugging" feature yet but I added one myself. I've been using it for the last year.

I also handle the cases when the line has to be moved back; I still mark it as MISALIGNED to signal the special case but at least it's placed on the right line.

If anyone wants to give it a try it can be download from here. More details inside README.txt

小ぇ时光︴ 2024-09-25 05:17:24

我使用 jad 并尽可能少地格式化,然后使用 eclipse 的 format 命令,因为我可以根据首选项使其符合我喜欢的样式。

I use jad with as little formatting as possible and then I use eclipse's format command, as I can make it match my preferred style from the preferences.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文