On 2/1/19 9:22 AM, Nick Gasson (Arm Technology China) wrote: > On AArch64, if you use "jhsdb clhsdb --pid=..." to attach a debugger to > a Java process, and then run "jstack -v" while any thread is executing a > native method, you will get a NullPointerException like this:
This does not happen for me. I have a test case which runs a native method; the native method does not return. I then run jstack -v and get a clean stack trace, regardless of whether it's interpreted or compiled: "main" #1 prio=5 tid=0x0000ffff7001a000 nid=0x596c runnable [0x0000ffff7624e000] java.lang.Thread.State: RUNNABLE JavaThread state: _thread_in_native - Spinner.main(java.lang.String[]) @bci=0, line=9, pc=0x0000ffff6d6954d8, Method*=0x0000ffff2321e380 (Compiled frame; information may be imprecise) Locked ownable synchronizers: - None I tries various combinations of Xcomp and tiered compilation. What did you do? -- Andrew Haley Java Platform Lead Engineer Red Hat UK Ltd. <https://www.redhat.com> EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
#include <jni.h> #include <stdio.h> /* * Class: Spinner * Method: run * Signature: ()V */ JNIEXPORT void JNICALL Java_Spinner_run (JNIEnv *env, jclass k) { printf("Spinning...\n"); for(;;); }
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class Spinner */ #ifndef _Included_Spinner #define _Included_Spinner #ifdef __cplusplus extern "C" { #endif /* * Class: Spinner * Method: run * Signature: ()V */ JNIEXPORT void JNICALL Java_Spinner_run (JNIEnv *, jclass); #ifdef __cplusplus } #endif #endif
public class Spinner { static native void run(); static { System.loadLibrary("Spinner"); } public static void main(String[] args) { run(); } }