简体   繁体   English

无法将HSDIS与OpenJDK 11一起使用

[英]Unable to use HSDIS with OpenJDK 11

So I am trying to build/use hsdis with openJDK-11. 因此,我正在尝试使用openJDK-11构建/使用hsdis。 if I try to build it with binutils I get the following errors: 如果我尝试使用binutils进行构建,则会出现以下错误:

hsdis.c:316:32: error: incompatible type for argument 1 of ‘disassembler'
app_data->dfn = disassembler(native_bfd);

hsdis.c:316:19: error: too few arguments to function ‘disassembler’
app_data->dfn = disassembler(native_bfd);

I have tried building it with binutils 2.29, 2.30, 2.31 and 2.32. 我尝试使用binutils 2.29、2.30、2.31和2.32构建它。 Got same error with all of them. 他们都遇到了同样的错误。

If I take a prebuilt binary from JDK-8 and place it in my build folder of JDK, netbeans refuses to acknowledge it is present in the folder. 如果我从JDK-8中获取一个预构建的二进制文件并将其放在我的JDK的build文件夹中,netbeans将拒绝确认它存在于该文件夹中。 I have set up OpenJDK in netbeans and generated a slowdebug build. 我已经在netbeans中设置了OpenJDK并生成了slowdebug构建。 I tried running it step by step to see where exactly hsdis is being searched for, to my surprise it does look in the folder where I placed the file however it still says no such file or directory. 我尝试逐步运行它以查看hsdis的确切搜索位置,令我惊讶的是它确实位于我放置文件的文件夹中,但是仍然没有显示该文件或目录。 For me that folder is 对我来说那个文件夹是

home/ubuntu/jdk11u-dev/build/linux-x86_64-normal-server-slowdebug/images/jdk/lib/server

I am using VMWare and running Ubuntu 18.04. 我正在使用VMWare并运行Ubuntu 18.04。 Any ideas what I can do? 有什么想法我能做什么?

I have tried building it with binutils 2.29, 2.30, 2.31 and 2.32. 我尝试使用binutils 2.29、2.30、2.31和2.32构建它。 Got same error with all of them. 他们都遇到了同样的错误。

The version of the source you have does not work with binutils 2.29+. 您拥有的源版本不适用于binutils 2.29+。 jdk/jdk has a patch to rectify this. jdk / jdk有一个补丁可以纠正此问题。 See: https://bugs.openjdk.java.net/browse/JDK-8191006 Which suggests the following fix to hsdis.c : 参见: https : hsdis.c这建议对hsdis.c进行以下修复:

diff --git a/src/share/tools/hsdis/hsdis.c b/src/share/tools/hsdis/hsdis.c
index 3d038f1..88122fb 100644
--- a/src/share/tools/hsdis/hsdis.c
+++ b/src/share/tools/hsdis/hsdis.c
@@ -30,6 +30,7 @@
 #include <config.h> /* required by bfd.h */
 #include <libiberty.h>
 #include <bfd.h>
+#include <bfdver.h>
 #include <dis-asm.h>
 #include <inttypes.h>
 #include <string.h>
@@ -312,7 +313,13 @@ static void setup_app_data(struct hsdis_app_data* app_data,

  /* Finish linking together the various callback blocks. */
  app_data->dinfo.application_data = (void*) app_data;
- app_data->dfn = disassembler(native_bfd);
+ app_data->dfn = disassembler(
+#if BFD_VERSION >= 229000000
+ bfd_get_arch(native_bfd),
+ bfd_big_endian(native_bfd),
+ bfd_get_mach(native_bfd),
+#endif
+ native_bfd);
  app_data->dinfo.print_address_func = hsdis_print_address_func;
  app_data->dinfo.read_memory_func = hsdis_read_memory_func; 

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

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