How to debug the openjdk9 by netbeans8.2 in win10?
Asked Answered
F

1

11

When I tried to debug the openjdk9 by netbeans8.2 in win10, I got the following error:

"\"D:/jdk9/jdk9/build/windows-x86_64-normal-server-fastdebug/jdk/bin/java.exe\": 
not in executable format: File format not recognized"

How can I fix it?

I build the source code by command "./configure -with-freetype=/cygdrive/c/freetype -enable-debug -with-target-bits=64", then run make all, I also tried slowdebug, however, that also failed.

enter image description here

If I "run" the project instead of "debug", it runs successfully like below, so there is no issue for the file windows-x86_64-normal-server-fastdebug/jdk/bin/java.exe, it seems the gdb doesn't recognize the java.exe file. enter image description here

Also I opened the openjdk source code from the location D:/jdk9/jdk/common/nb_native by netbeans, see below: enter image description here

And tried to build it by netbeans, however, it produces the following error:

cd 'D:\jdk9\jdk\common'
sh ../configure --with-freetype=/cygdrive/c/freetype --with-debug-level=slowdebug --with-target-bits=64
/cygdrive/d/jdk9/jdk/configure: /cygdrive/d/jdk9/jdk/common/autoconf/configure: No such file or directory
PRE-BUILD FAILED (exit value 1, total time: 743ms)

I know that both paths /cygdrive/d/jdk9/jdk/configure and /cygdrive/d/jdk9/jdk/common/autoconf/configure exist.

This is how I configured the pre-built commands: enter image description here

Flosi answered 6/10, 2018 at 14:15 Comment(5)
Try to build "-with-target-bits=32" instead of 64, or check that you installed 64-bit gdb.Zobias
Yes,It wouldnt get that exception after changing to gdb64, however it cannot stop at the breakpoints , I have no idea if I used the wrong way to importing the sources . you ever mentioned import the source by "find nbproject configuration inside your openjdk repository and import it into the NetBeans" ,I saw the config files configurations.xml and project.xml , however I didn't find the way to import them into netbeans directly , so I import the source by open the folder common/nb_native which I described in question , if this way to import source code is ok? BTW, I'm ok to mark your answer.Flosi
BTW, I built the source code in the Cygwin64 instead of by the NetBeans itself.Flosi
I set the breapoints in class classLoader.cpp, and I verified that the same breakpoints worked correctly when I did debug by visual studio.Flosi
BTW, I installed the 64-bit gdb by Cygwin64 ,and I tried to build the source again by netbeans itself, however I always failed, you can see the error info in the end of the updated question.Flosi
Z
3
  1. If you build the openjdk -with-target-bits = 64, then make sure that you installed a 64-bit gdb, or build the openjdk in 32-bit mode.

  2. Your steps to import the nbproject looks correct.

  3. Change Build => Pre-Build properties:

    Set "Working Directory" to ../..

    Set "Command Line" to sh ./configure ...

Zobias answered 11/10, 2018 at 21:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.