oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀

Home Page:https://www.graalvm.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to use GDB to debug the actual value of variables in GraalVM Native Image

linghengqian opened this issue · comments

Describe the issue
A clear and concise description of the issue. We recommend using the latest snapshot builds to replicate the issue as bugs are constantly being fixed in the master branch

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. Execute the following command on Ubuntu 22.04.4 with SDKMAN! and IntelliJ IDEA 2024.2.0.1 (Ultimate Edition) installed.
sdk install java 22.0.2-graalce

sudo apt update && sudo apt upgrade -y
sudo apt install build-essential gdb -y
sudo apt install gdbserver -y

git clone git@github.com:linghengqian/native-image-debug-test.git
cd ./native-image-debug-test/
sdk use java 22.0.2-graalce
./mvnw -PnativeTestInCustom -T1C -e clean test
  1. Install the IDE plugins https://plugins.jetbrains.com/plugin/19237-graalvm-native-debugger
    and https://plugins.jetbrains.com/plugin/12775-native-debugging-support
    for IntelliJ IDEA 2024.2.0.1 (Ultimate Edition).

  2. Set a breakpoint.

  • image
  1. A new profile is added in IntelliJ IDEA 2024.2.0.1 (Ultimate Edition).
  • image
  1. Start the GraalVM Native Image on host port 12345.
cd ./native-image-debug-test/

gdbserver :12345 ./target/native-tests --xml-output-dir ./target/native-test-reports -Djunit.platform.listeners.uid.tracking.output.dir=./target/test-ids
  1. Switch to the newly set run/debug configuration and press shift+F9 to start debugging.
  • At this time, it is not possible to view the actual value of the variable.
  • image

Describe GraalVM and your environment:

  • GraalVM version (latest snapshot builds can be found here), or commit id if built from source: [e.g. EE 19.3, CE 20.0, CE 20.1.0-dev-20200304_0848] CE 24.0.2 For JDK 22.0.2
  • JDK major version: [e.g.:8] 22
  • OS: [e.g. macOS Catalina] Ubuntu 22.04.4
  • Architecture: [e.g.: AMD64] AMD64

More details
Consider adding the --native-image-info and --verbose flags when building your native image and paste output below.

Add any other information about the problem here. Especially important are stack traces or log output. Feel free to link to gists or to screenshots if necessary.

  • More early investigation is at apache/shardingsphere-elasticjob#2428 .
  • Honestly, I don't know if this is an IntelliJ IDEA issue. But I'm a GDB newbie myself and I wanted to confirm on the GraalVM side first.
  • I assume that GDB can debug into the actual values ​​of variables in the GraalVM Native Image, because Jetbrains or the GraalVM community advertised this in the gif at https://x.com/graalvm/status/1537851767320371204 .
  • image

Hi, Thank you for reporting this, we'll take a look into it shortly