Skip to content

Commit 90c177a

Browse files
committed
Review and move javagdbnative demo to archive
1 parent bcf2be7 commit 90c177a

File tree

4 files changed

+30
-56
lines changed

4 files changed

+30
-56
lines changed

archive/javagdbnative/README.MD

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Native Image Debugging from Java Source Code
2+
3+
This demo is intended to demonstrate how to debug a Java application, built into a native executable, using the [Debug Info Feature in Native Image](https://www.graalvm.org/latest/reference-manual/native-image/debugging-and-diagnostics/DebugInfo/).
4+
5+
> Prerequisites: Linux OS with 10.2 or later
6+
7+
## Build a Native Executable with Debug Information
8+
9+
1. Clone Download or clone the GraalVM Demos repository:
10+
```bash
11+
git clone https://github.com/graalvm/graalvm-demos
12+
```
13+
14+
2. Navigate to the example directory:
15+
```bash
16+
cd graalvm-demos/archive/javagdbnative
17+
```
18+
19+
3. Compile and build the application with Maven:
20+
```shell
21+
mvn -Pnative -DskipTests package
22+
```
23+
The command packages a Java application into a runnable JAR file, and then builds a native executable of it.
24+
The `-g` option that is passed to the `native-image` tool in _pom.xml_ causes debug information to be generated.
25+
Next to the native executable, you see the _<executable_name>.debug_ file that contains debug information, and the _sources_ directory containing Java source files, which the debugger uses to show sources for line information.
26+
27+
Now you can debug your native executable with GDB as shown in [this guide](https://www.graalvm.org/latest/reference-manual/native-image/guides/debug-native-image-process/).

javagdbnative/pom.xml renamed to archive/javagdbnative/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
<version>1.0-SNAPSHOT</version>
1010

1111
<name>javagdbnative</name>
12-
<!-- FIXME change it to the project's website -->
13-
<url>https://github.com/graalvm/graalvm-demos</url>
1412

1513
<properties>
1614
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -36,7 +34,7 @@
3634
<plugin>
3735
<groupId>org.graalvm.buildtools</groupId>
3836
<artifactId>native-maven-plugin</artifactId>
39-
<version>0.9.7</version> <!-- or newer version -->
37+
<version>0.10.4</version> <!-- or newer version -->
4038
<executions>
4139
<execution>
4240
<id>test-native</id>
@@ -57,8 +55,7 @@
5755
<imageName>javagdb</imageName>
5856
<mainClass>javagdb.App</mainClass>
5957
<buildArgs>
60-
--no-fallback
61-
--verbose
58+
<buildArg>--verbose</buildArg>
6259
<buildArg>-g</buildArg>
6360
<buildArg>-O0</buildArg>
6461
</buildArgs>
@@ -67,5 +64,5 @@
6764
</plugins>
6865
</build>
6966
</profile>
70-
</profiles>
67+
</profiles>
7168
</project>

javagdbnative/README.MD

Lines changed: 0 additions & 50 deletions
This file was deleted.

0 commit comments

Comments
 (0)