Skip to content

Commit 4d10d39

Browse files
authored
Merge pull request #320 from graalvm/archive-demos
[GR-60094] Review and move javagdbnative demo to archive.
2 parents ca2076d + f9b9ebb commit 4d10d39

File tree

6 files changed

+41
-76
lines changed

6 files changed

+41
-76
lines changed
Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,32 @@
1-
name: javagdbnative
1+
name: archive/javagdbnative
22
on:
33
push:
44
paths:
5-
- 'javagdbnative/**'
6-
- '.github/workflows/javagdbnative.yml'
5+
- 'archive/javagdbnative/**'
6+
- '.github/workflows/archive-javagdbnative.yml'
77
pull_request:
88
paths:
9-
- 'javagdbnative/**'
10-
- '.github/workflows/javagdbnative.yml'
11-
schedule:
12-
- cron: "0 0 1 * *" # run every month
9+
- 'archive/javagdbnative/**'
10+
- '.github/workflows/archive-javagdbnative.yml'
1311
workflow_dispatch:
1412
permissions:
1513
contents: read
1614
jobs:
1715
run:
18-
name: Run 'javagdbnative'
16+
name: Run 'archive/javagdbnative'
1917
runs-on: ubuntu-latest
2018
timeout-minutes: 15
21-
strategy:
22-
matrix:
23-
java-version: ['17', 'dev']
2419
steps:
2520
- uses: actions/checkout@v4
2621
- uses: graalvm/setup-graalvm@v1
2722
with:
28-
java-version: ${{ matrix.java-version }}
23+
java-version: '21'
2924
distribution: 'graalvm'
3025
github-token: ${{ secrets.GITHUB_TOKEN }}
3126
cache: 'maven'
3227
native-image-job-reports: 'true'
33-
- name: Run 'javagdbnative'
28+
- name: Run 'archive/javagdbnative'
3429
run: |
35-
cd javagdbnative
30+
cd archive/javagdbnative
3631
mvn -Pnative -DskipTests --no-transfer-progress package
3732
./target/javagdb

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ cd graalvm-demos
5959
<td align="left" width="30%"><a href="/native-netty-plot/">native-netty-plot</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/native-netty-plot.yml"><img alt="native-netty-plot" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-netty-plot.yml/badge.svg" /></a></td>
6060
<td align="left" width="70%">A web server application, using the Netty framework, to demonstrate the use of isolates with Native Image<br><strong>Technologies: </strong>Native Image, Maven, Netty<br><strong>Reference: </strong><a href="https://medium.com/graalvm/instant-netty-startup-using-graalvm-native-image-generation-ed6f14ff7692">Instant Netty Startup using GraalVM Native Image Generation</a></td>
6161
</tr>
62-
<tr>
63-
<td align="left" width="30%"><a href="/javagdbnative/">javagdbnative</a><br><a href="https://github.com/graalvm/graalvm-demos/actions/workflows/javagdbnative.yml"><img alt="javagdbnative" src="https://github.com/graalvm/graalvm-demos/actions/workflows/javagdbnative.yml/badge.svg" /></a></td>
64-
<td align="left" width="70%">Demonstrates how to debug a Java application, built into a native executable in VS Code<br><strong>Technologies: </strong>Native Image, Maven, GraalVM Tools for Java<br><strong>Reference: </strong><a href="https://medium.com/graalvm/native-image-debugging-in-vs-code-2d5dda1989c1">Native Image Debugging in VS Code</a></td>
65-
</tr>
6662
<tr>
6763
<td align="left" width="30%"><a href="/native-image/add-logging/">native-image/add-logging</a><br><a href="https://github.com/graalvm/graalvm-demos/blob/ni-logging-demo/.github/workflows/native-image-add-logging.yml"><img alt="add-logging" src="https://github.com/graalvm/graalvm-demos/actions/workflows/native-image-add-logging.yml/badge.svg" /></a></td>
6864
<td align="left" width="70%">Demonstrates how to initialize Loggers with Native Image at the executable build or run time<br><strong>Technologies: </strong> Native Image<br><strong>Reference: </strong><a href="https://www.graalvm.org/latest/reference-manual/native-image/guides/add-logging-to-native-executable/">Add Logging to a Native Executable</a></td>

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: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,11 @@
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>
17-
<maven.compiler.source>1.8</maven.compiler.source>
18-
<maven.compiler.target>1.8</maven.compiler.target>
15+
<maven.compiler.source>21</maven.compiler.source>
16+
<maven.compiler.target>21</maven.compiler.target>
1917
</properties>
2018

2119
<dependencies>
@@ -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)