Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
name: javagdbnative
name: archive/javagdbnative
on:
push:
paths:
- 'javagdbnative/**'
- '.github/workflows/javagdbnative.yml'
- 'archive/javagdbnative/**'
- '.github/workflows/archive-javagdbnative.yml'
pull_request:
paths:
- 'javagdbnative/**'
- '.github/workflows/javagdbnative.yml'
schedule:
- cron: "0 0 1 * *" # run every month
- 'archive/javagdbnative/**'
- '.github/workflows/archive-javagdbnative.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
run:
name: Run 'javagdbnative'
name: Run 'archive/javagdbnative'
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
matrix:
java-version: ['17', 'dev']
steps:
- uses: actions/checkout@v4
- uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ matrix.java-version }}
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
cache: 'maven'
native-image-job-reports: 'true'
- name: Run 'javagdbnative'
- name: Run 'archive/javagdbnative'
run: |
cd javagdbnative
cd archive/javagdbnative
mvn -Pnative -DskipTests --no-transfer-progress package
./target/javagdb
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ cd graalvm-demos
<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>
<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>
</tr>
<tr>
<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>
<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>
</tr>
<tr>
<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>
<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>
Expand Down
27 changes: 27 additions & 0 deletions archive/javagdbnative/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Native Image Debugging from Java Source Code

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/).

> Prerequisites: Linux OS with 10.2 or later

## Build a Native Executable with Debug Information

1. Clone Download or clone the GraalVM Demos repository:
```bash
git clone https://github.com/graalvm/graalvm-demos
```

2. Navigate to the example directory:
```bash
cd graalvm-demos/archive/javagdbnative
```

3. Compile and build the application with Maven:
```shell
mvn -Pnative -DskipTests package
```
The command packages a Java application into a runnable JAR file, and then builds a native executable of it.
The `-g` option that is passed to the `native-image` tool in _pom.xml_ causes debug information to be generated.
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.

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/).
13 changes: 5 additions & 8 deletions javagdbnative/pom.xml → archive/javagdbnative/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
<version>1.0-SNAPSHOT</version>

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

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
</properties>

<dependencies>
Expand All @@ -36,7 +34,7 @@
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<version>0.9.7</version> <!-- or newer version -->
<version>0.10.4</version> <!-- or newer version -->
<executions>
<execution>
<id>test-native</id>
Expand All @@ -57,8 +55,7 @@
<imageName>javagdb</imageName>
<mainClass>javagdb.App</mainClass>
<buildArgs>
--no-fallback
--verbose
<buildArg>--verbose</buildArg>
<buildArg>-g</buildArg>
<buildArg>-O0</buildArg>
</buildArgs>
Expand All @@ -67,5 +64,5 @@
</plugins>
</build>
</profile>
</profiles>
</profiles>
</project>
50 changes: 0 additions & 50 deletions javagdbnative/README.MD

This file was deleted.

Loading