On Mon, 2 Nov 2026 15:09:48 GMT, Kevin Walls <[email protected]> wrote:

>> This implements "jcmd on core files" for Linux, and for MiniDumps on Windows 
>> (MacOS is "future work").
>> jcmd "revives" the VM memory and .so/.dll from the core/minidump, and runs 
>> the existing native diagnostic command parser and command implementations.
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Kevin Walls has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Update.  Includes reverting removal of DebuggingContext and error handling 
> in HotSpotVirtualMachineCoreDump.java

src/jdk.attach/linux/native/revivalhelper/elffile.cpp line 59:

> 57: #else
> 58:         case R_X86_64_RELATIVE:
> 59: #endif

@kevinjwalls : Hi, do you mind adding the following small addon change to 
support core revival on riscv64? The new test 
`test/hotspot/jtreg/serviceability/revival/JCmdRevival.java` fails on this 
platform without this addon change and passes otherwise.


diff --git a/src/jdk.attach/linux/native/revivalhelper/elffile.cpp 
b/src/jdk.attach/linux/native/revivalhelper/elffile.cpp
index 8e73e0f78e4..40211c3cb26 100644
--- a/src/jdk.attach/linux/native/revivalhelper/elffile.cpp
+++ b/src/jdk.attach/linux/native/revivalhelper/elffile.cpp
@@ -54,6 +54,8 @@ bool should_relocate_addend(Elf64_Rela* rela) {
     switch (ELF64_R_TYPE(rela->r_info)) {
 #if defined(__aarch64__)
         case R_AARCH64_RELATIVE:
+#elif defined(__riscv) && __riscv_xlen == 64
+        case R_RISCV_RELATIVE:
 #else
         case R_X86_64_RELATIVE:
 #endif
@@ -114,6 +116,11 @@ bool ELFFile::verify() {
         warn("%s: not an AARCH64 ELF file.", filename);
         return false;
     }
+#elif defined(__riscv) && __riscv_xlen == 64
+    if (hdr->e_machine != EM_RISCV) {
+        warn("%s: not a RISCV64 ELF file.", filename);
+        return false;
+    }
 #else
     if (hdr->e_machine != EM_X86_64) {
         warn("%s: not an X86_64 ELF file.", filename);

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/31011#discussion_r4476315223

Reply via email to