Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/57.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JVM在打印stacktrace时崩溃_Java_C_Jvm_Java Native Interface_Invocation Api - Fatal编程技术网

Java JVM在打印stacktrace时崩溃

Java JVM在打印stacktrace时崩溃,java,c,jvm,java-native-interface,invocation-api,Java,C,Jvm,Java Native Interface,Invocation Api,我想将异常stacktrace转换为C中的字符串。 我有以下代码: (main.c) (B.java) 要复制此崩溃,请执行以下操作: 编译main.c(gcc-I$JAVA\u HOME/include-I$JAVA\u HOME/include/linux main.c-L$JAVA\u HOME/lib/server-ljvm-g3-Og) 编译A.java和B.java(javac*.java) 删除B.class(因此A的加载失败) 现在我想执行a.out: $./a.out # #

我想将异常stacktrace转换为C中的字符串。 我有以下代码:

(main.c)

(B.java)

要复制此崩溃,请执行以下操作:

  • 编译main.c(
    gcc-I$JAVA\u HOME/include-I$JAVA\u HOME/include/linux main.c-L$JAVA\u HOME/lib/server-ljvm-g3-Og
  • 编译A.java和B.java(
    javac*.java
  • 删除B.class(因此A的加载失败)
  • 现在我想执行a.out:

    $./a.out
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007f3a78062056, pid=280779, tid=280779
    #
    # JRE version: OpenJDK Runtime Environment (15.0.1+9) (build 15.0.1+9-Debian-3)
    # Java VM: OpenJDK 64-Bit Server VM (15.0.1+9-Debian-3, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
    # Problematic frame:
    # V  [libjvm.so+0x534056]
    #
    # Core dump will be written. Default location: /home/<userName>/dir/core
    #
    # An error report file with more information is saved as:
    # /home/<userName>/dir/hs_err_pid280779.log
    #
    # If you would like to submit a bug report, please visit:
    #   https://bugs.debian.org/openjdk-15
    #
    Aborted (core dumped)
    
    如果我不添加任何命令行参数,它甚至会崩溃

    编辑: 回溯(gdb)是:

    #0(信号)=sig@entry=6)at../sysdeps/unix/sysv/linux/raise.c:50
    #1 0x00007fd526b0f537 in_uuugi_uabort()位于中止位置。c:79
    #2 0x00007fd526ebd3b3位于./src/hotspot/os/linux/os_linux.cpp:1542处的操作系统::中止(dump_core=,siginfo=,context=)
    #VMError::report_and_die(id=,message)中的3 0x00007fd527ac388a=message@entry=0x0,细节\u fmt=,细节\u参数=细节_args@entry=0x7ffef14f0ba8,螺纹=thread@entry=0x55d76b440d50,
    个人电脑=pc@entry=0x7fd5271e3056“f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230),siginfo=0x7ffef14f0f30,上下文=0x7ffef14f0e00,
    filename=,lineno=0,size=0)位于./src/hotspot/share/utilities/vmError.cpp:1635
    #VMError中的4 0x00007fd527ac40cb::报告_和_模具(螺纹=thread@entry=0x55d76b440d50,信号=sig@entry=11, 
    个人电脑=pc@entry=0x7fd5271e3056“f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230),siginfo=siginfo@entry=0x7ffef14f0f30,
    上下文=context@entry=0x7ffef14f0e00,详图\u fmt=详图_fmt@entry=0x7fd527b848ae“%s”)位于./src/hotspot/share/utilities/vmError.cpp:1315
    #VMError中的5 0x00007fd527ac40fe::报告_和_模具(螺纹=thread@entry=0x55d76b440d50,信号=sig@entry=11, 
    个人电脑=pc@entry=0x7fd5271e3056“f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230),siginfo=siginfo@entry=0x7ffef14f0f30,
    上下文=context@entry=0x7ffef14f0e00)位于./src/hotspot/share/utilities/vmError.cpp:1321
    #JVM_句柄_linux_信号中的6 0x00007fd527800fc2(sig=sig@entry=11,信息=info@entry=0x7ffef14f0f30,ucVoid=ucVoid@entry=0x7ffef14f0e00,如果未识别,则中止=如果未识别,则中止_unrecognized@entry=1)
    在./src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:601
    #7 0x00007fd5277f4738位于/src/hotspot/os/linux/os_linux.cpp处的信号处理器中(sig=11,info=0x7ffef14f0f30,uc=0x7ffef14f0e00)
    #8  
    #编译策略中的9 0x00007fd5271e3056::可以在./src/hotspot/share/compiler/compilementpolicy.cpp:118处编译(m=…,comp-level=-2)
    #编译策略::中的10 0x00007fd5271e313d必须在./src/hospot/share/compiler/compilementpolicy.cpp:79处编译(编译级别=-2,m=…)
    #11编译策略::在./src/hotspot/share/compiler/compileationpolicy.cpp:86处编译(如果需要)(所选的方法=…,线程=
    #CallInfo::set_common中的12 0x00007fd527685656(u线程,索引=15,种类=CallInfo::vtable_调用,所选方法=…,已解析方法=…,已解析klass=0x800149798,此=0x7ffef14f16d0)
    在./src/hotspot/share/解释器/linkResolver.cpp:128
    #13 CallInfo::在./src/hotspot/share/interpreter/linkResolver.cpp:91处设置虚拟(虚拟线程,vtable索引=15,选择的方法=…,解析的方法=…,解析的方法=…,解析的klass=0x800149798,this=0x7ffef14f16d0)
    #14 LinkResolver::runtime_resolve_virtual_方法(结果=…,resolved_方法=…,resolved_klass=,recv=。。。,recv@entry=…,recv_klass=recv_klass@entry=0x800007438,
    check_null_和_abstract=check_null_和_abstract@entry=true,uu线程(位于./src/hotspot/share/interpreter/linkResolver.cpp:1424)
    #15 0x00007fd527687103在LinkResolver::resolve_virtual_调用中(u线程=0x55d76b440d50,检查_null_和_abstract=true,link_info=…,receiver_klass=0x80007438,recv=…,result=…)
    在./src/hotspot/share/解释器/linkResolver.cpp:1311
    #16 LinkResolver::resolve_invokevirtual(uu线程=0x55d76b440d50,索引=,池=…,recv=…,结果=…)位于./src/hotspot/share/expressor/LinkResolver.cpp:1689
    #17 LinkResolver::resolve_调用(结果=…,recv=…,池=…,索引=,字节=byte@entry=字节码::\u invokevirtual,\u线程\u=\u线程\u@entry=0x55d76b440d50)
    在./src/hotspot/share/解释器/linkResolver.cpp:1633
    #解释器中的18 0x00007fd52742ef88实时::解析_调用(线程=thread@entry=0x55d76b440d50,字节码=字节码::_invokevirtual)位于./src/hotspot/share/explorer/explorerruntime.cpp:854
    #19解释器中的0x00007fd52742f567 rruntime::从_缓存(线程=0x55d76b440d50,字节码=)解析_,地址为./src/hotspot/share/解释器/解释器rruntime.cpp:991
    #20 0x00007fd50efb1aac英寸()
    #21 0x00007fd5087300f0英寸()
    #22 0x00007fd50efb1a72英寸()
    #23 0x0000000000000021英寸???()
    #24 0x0000000000000000英寸???()
    
    编辑2:

    在试图解决此问题时,我反汇编了PrintWriter::write:

    public void write(java.lang.String, int, int);
        descriptor: (Ljava/lang/String;II)V
        flags: (0x0001) ACC_PUBLIC
        Code:
          stack=4, locals=6, args_size=4
             0: aload_0
             1: getfield      #97                 // Field lock:Ljava/lang/Object;
             4: dup
             5: astore        4
             7: monitorenter
             8: aload_0
             9: invokevirtual #101                // Method ensureOpen:()V
            12: aload_0
            13: getfield      #43                 // Field out:Ljava/io/Writer;
            16: aload_1
            17: iload_2
            18: iload_3
            19: invokevirtual #136      <--This instruction is crashing          // Method java/io/Writer.write:(Ljava/lang/String;II)V`
            22: aload         4
            24: monitorexit
            25: goto          36
            28: astore        5
            30: aload         4
            32: monitorexit
            33: aload         5
            35: athrow
            36: goto          57
            39: astore        4
            41: invokestatic  #123                // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
            44: invokevirtual #129                // Method java/lang/Thread.interrupt:()V
            47: goto          57
            50: astore        4
            52: aload_0
            53: iconst_1
            54: putfield      #35                 // Field trouble:Z
            57: return
    
    public void write(java.lang.String,int,int);
    描述符:(Ljava/lang/String;II)V
    标志:(0x0001)ACC\U PUBLIC
    代码:
    堆栈=4,局部变量=6,参数大小=4
    0:aload_0
    1:getfield#97//字段锁:Ljava/lang/Object;
    4:dup
    5:astore 4
    7:监视器中心
    8:aload_0
    9:invokevirtual#101//方法ensureOpen:()V
    12:aload_0
    13:getfield#43//fieldout:Ljava/io/Writer;
    16:aload_1
    17:iload_2
    18:iload_3
    19:invokevirtual#136 FindClass(环境,“A”);
    断言(cls==NULL);
    jthrowable throwable=(*env)->例外发生(env);
    (*env)->例外说明(env);
    如果(可丢弃){
    (*env)->例外清除(env);
    jclass stringWriter=(*env)->FindClass(env,“java/io/stringWriter”);
    断言(stringWriter);
    jclass printWriter=(*env)->FindClass(env,“java/io/printWriter”);
    断言(打印作者);
    jmethodID noArgsConstructor=
    (*env)->GetMethodID(env,stringWriter,“,”()V”);
    断言(noargsconstuctor);
    J
    
    public class B{}
    
    $./a.out
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007f3a78062056, pid=280779, tid=280779
    #
    # JRE version: OpenJDK Runtime Environment (15.0.1+9) (build 15.0.1+9-Debian-3)
    # Java VM: OpenJDK 64-Bit Server VM (15.0.1+9-Debian-3, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
    # Problematic frame:
    # V  [libjvm.so+0x534056]
    #
    # Core dump will be written. Default location: /home/<userName>/dir/core
    #
    # An error report file with more information is saved as:
    # /home/<userName>/dir/hs_err_pid280779.log
    #
    # If you would like to submit a bug report, please visit:
    #   https://bugs.debian.org/openjdk-15
    #
    Aborted (core dumped)
    
    #
    # A fatal error has been detected by the Java Runtime Environment:
    #
    #  SIGSEGV (0xb) at pc=0x00007f3a78062056, pid=280779, tid=280779
    #
    # JRE version: OpenJDK Runtime Environment (15.0.1+9) (build 15.0.1+9-Debian-3)
    # Java VM: OpenJDK 64-Bit Server VM (15.0.1+9-Debian-3, mixed mode, sharing, tiered, compressed oops, g1 gc, linux-amd64)
    # Problematic frame:
    # V  [libjvm.so+0x534056]
    #
    # Core dump will be written. Default location: /home/<userName>/dir/core
    #
    # If you would like to submit a bug report, please visit:
    #   https://bugs.debian.org/openjdk-15
    #
    
    ---------------  S U M M A R Y ------------
    
    Command Line: --enable-preview -XX:+ShowCodeDetailsInExceptionMessages 
    
    Host: Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz, 8 cores, 7G, Debian GNU/Linux bullseye/sid
    Time: Sat Jan  2 08:35:27 2021 CET elapsed time: 0.039155 seconds (0d 0h 0m 0s)
    
    ---------------  T H R E A D  ---------------
    
    Current thread (0x00005568f9ab4dc0):  JavaThread "main" [_thread_in_vm, id=280779, stack(0x00007ffc508ef000,0x00007ffc509ef000)]
    
    Stack: [0x00007ffc508ef000,0x00007ffc509ef000],  sp=0x00007ffc509ed070,  free space=1016k
    Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V  [libjvm.so+0x534056]
    V  [libjvm.so+0x53413d]
    V  [libjvm.so+0x9d6656]
    V  [libjvm.so+0x9d8103]
    V  [libjvm.so+0x77ff88]
    V  [libjvm.so+0x780567]
    j  java.io.PrintWriter.write(Ljava/lang/String;II)V+19 java.base@15.0.1
    j  java.io.PrintWriter.write(Ljava/lang/String;)V+7 java.base@15.0.1
    j  java.io.PrintWriter.print(Ljava/lang/String;)V+5 java.base@15.0.1
    j  java.io.PrintWriter.println(Ljava/lang/Object;)V+14 java.base@15.0.1
    j  java.lang.Throwable$WrappedPrintWriter.println(Ljava/lang/Object;)V+5 java.base@15.0.1
    j  java.lang.Throwable.printStackTrace(Ljava/lang/Throwable$PrintStreamOrWriter;)V+28 java.base@15.0.1
    j  java.lang.Throwable.printStackTrace(Ljava/io/PrintWriter;)V+9 java.base@15.0.1
    v  ~StubRoutines::call_stub
    V  [libjvm.so+0x784c49]
    V  [libjvm.so+0x8193eb]
    V  [libjvm.so+0x819eec]
    
    Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
    j  java.io.PrintWriter.write(Ljava/lang/String;II)V+19 java.base@15.0.1
    j  java.io.PrintWriter.write(Ljava/lang/String;)V+7 java.base@15.0.1
    j  java.io.PrintWriter.print(Ljava/lang/String;)V+5 java.base@15.0.1
    j  java.io.PrintWriter.println(Ljava/lang/Object;)V+14 java.base@15.0.1
    j  java.lang.Throwable$WrappedPrintWriter.println(Ljava/lang/Object;)V+5 java.base@15.0.1
    j  java.lang.Throwable.printStackTrace(Ljava/lang/Throwable$PrintStreamOrWriter;)V+28 java.base@15.0.1
    j  java.lang.Throwable.printStackTrace(Ljava/io/PrintWriter;)V+9 java.base@15.0.1
    v  ~StubRoutines::call_stub
    
    siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000039
    
    Register to memory mapping:
    
    RAX=0x0000000000000011 is an unknown value
    RBX=0x00007ffc509ed0f0 is pointing into the stack for thread: 0x00005568f9ab4dc0
    RCX=0x0000000020000001 is an unknown value
    RDX=0x0000000800149798 is a pointer to class: 
    java.io.Writer {0x0000000800149798}
    RSP=0x00007ffc509ed070 is pointing into the stack for thread: 0x00005568f9ab4dc0
    RBP=0x00007ffc509ed080 is pointing into the stack for thread: 0x00005568f9ab4dc0
    RSI=0x00000000fffffffe points into unknown readable memory: 00 00
    RDI=0x00000008000097a8 is a pointer to class: 
    java.lang.constant.Constable {0x00000008000097a8}
    R8 =0x00005568f9ab5450 points into unknown readable memory: 0x00000008000270b0 | b0 70 02 00 08 00 00 00
    R9 =0x00007ffc509ed0f0 is pointing into the stack for thread: 0x00005568f9ab4dc0
    R10=0x00000008003fd6f8 is pointing into metadata
    R11=0x000000080041c940 is pointing into metadata
    R12=0x0 is NULL
    R13=0x00007ffc509ed0f0 is pointing into the stack for thread: 0x00005568f9ab4dc0
    R14=0x000000000000000f is an unknown value
    R15=0x00007ffc509ed170 is pointing into the stack for thread: 0x00005568f9ab4dc0
    
    
    Registers:
    RAX=0x0000000000000011, RBX=0x00007ffc509ed0f0, RCX=0x0000000020000001, RDX=0x0000000800149798
    RSP=0x00007ffc509ed070, RBP=0x00007ffc509ed080, RSI=0x00000000fffffffe, RDI=0x00000008000097a8
    R8 =0x00005568f9ab5450, R9 =0x00007ffc509ed0f0, R10=0x00000008003fd6f8, R11=0x000000080041c940
    R12=0x0000000000000000, R13=0x00007ffc509ed0f0, R14=0x000000000000000f, R15=0x00007ffc509ed170
    RIP=0x00007f3a78062056, EFLAGS=0x0000000000010202, CSGSFS=0x002b000000000033, ERR=0x0000000000000004
      TRAPNO=0x000000000000000e
    
    Top of Stack: (sp=0x00007ffc509ed070)
    0x00007ffc509ed070:   00005568f9ab4dc0 00007ffc509ed0f0
    0x00007ffc509ed080:   00007ffc509ed0c0 00007f3a7806213d
    0x00007ffc509ed090:   00007ffc509ed150 00007f3a78503fca
    0x00007ffc509ed0a0:   00007ffc509ed0e0 00007ffc509ed290 
    
    Instructions: (pc=0x00007f3a78062056)
    0x00007f3a78061f56:   c3 66 0f 1f 84 00 00 00 00 00 e8 fb 56 5a 00 83
    0x00007f3a78061f66:   f0 01 84 c0 74 e4 48 8d 05 a8 42 c5 00 80 38 00
    0x00007f3a78061f76:   75 08 b8 01 00 00 00 eb d3 90 4c 8d 25 84 42 c5
    0x00007f3a78061f86:   00 41 80 3c 24 00 74 c2 48 8d 05 c3 d3 cb 00 80
    0x00007f3a78061f96:   38 00 74 b6 48 8b 3b 8b 47 20 85 c0 79 6a a9 00
    0x00007f3a78061fa6:   00 00 40 74 a5 48 8d 05 d6 2c c5 00 8b 00 83 f8
    0x00007f3a78061fb6:   01 0f 94 c0 eb 96 0f 1f 40 00 48 8d 05 f9 3e c5
    0x00007f3a78061fc6:   00 80 38 00 74 2c be 01 00 00 00 e8 8a 56 5a 00
    0x00007f3a78061fd6:   84 c0 74 92 48 8b 3b be 04 00 00 00 e8 79 56 5a
    0x00007f3a78061fe6:   00 84 c0 0f 85 61 ff ff ff e9 78 ff ff ff 0f 1f
    0x00007f3a78061ff6:   40 00 48 8d 05 ed 2c c5 00 8b 30 e8 5a 56 5a 00
    0x00007f3a78062006:   83 f0 01 e9 5a ff ff ff e8 dd 9f 5a 00 84 c0 0f
    0x00007f3a78062016:   84 35 ff ff ff 41 80 3c 24 00 0f 84 2a ff ff ff
    0x00007f3a78062026:   eb 83 0f 1f 84 00 00 00 00 00 55 48 89 e5 41 54
    0x00007f3a78062036:   45 31 e4 53 48 89 fb 48 8b 3f f6 47 21 04 75 3d
    0x00007f3a78062046:   48 8d 05 bc 41 c5 00 80 38 00 74 0c 48 8b 47 08
    0x00007f3a78062056:   66 81 78 28 40 1f 77 25 0f b7 47 28 83 e8 06 66
    0x00007f3a78062066:   83 f8 20 77 25 48 8d 15 a2 90 98 00 0f b7 c0 48
    0x00007f3a78062076:   63 04 82 48 01 d0 ff e0 66 90 45 31 e4 44 89 e0
    0x00007f3a78062086:   5b 41 5c 5d c3 0f 1f 44 00 00 83 fe fe 74 23 8d
    0x00007f3a78062096:   46 ff 45 31 e4 83 f8 03 77 e3 e8 bb 55 5a 00 5b
    0x00007f3a780620a6:   83 f0 01 41 89 c4 44 89 e0 41 5c 5d c3 0f 1f 44
    0x00007f3a780620b6:   00 00 48 8d 05 01 3e c5 00 44 0f b6 20 45 84 e4
    0x00007f3a780620c6:   74 28 be 01 00 00 00 e8 8e 55 5a 00 84 c0 74 ad
    0x00007f3a780620d6:   48 8b 3b be 04 00 00 00 e8 7d 55 5a 00 83 f0 01
    0x00007f3a780620e6:   41 89 c4 eb 98 0f 1f 44 00 00 48 8d 05 f5 2b c5
    0x00007f3a780620f6:   00 8b 30 e8 62 55 5a 00 83 f0 01 41 89 c4 e9 7a
    0x00007f3a78062106:   ff ff ff 90 66 0f 1f 44 00 00 48 8b 07 48 8b 40
    0x00007f3a78062116:   40 48 85 c0 74 04 c3 0f 1f 00 55 48 89 e5 41 55
    0x00007f3a78062126:   41 54 49 89 fc 53 48 89 f3 be fe ff ff ff 48 83
    0x00007f3a78062136:   ec 18 e8 f3 fe ff ff 84 c0 74 4a 48 8d 05 d3 40
    0x00007f3a78062146:   c5 00 80 38 00 74 53 4c 8d 2d b7 40 c5 00 41 80 
    ....
    
    openjdk 15.0.1 2020-10-20
    OpenJDK Runtime Environment (build 15.0.1+9-Debian-3)
    OpenJDK 64-Bit Server VM (build 15.0.1+9-Debian-3, mixed mode, sharing)
    
    #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
    #1  0x00007fd526b0f537 in __GI_abort () at abort.c:79
    #2  0x00007fd526ebd3b3 in os::abort (dump_core=<optimized out>, siginfo=<optimized out>, context=<optimized out>) at ./src/hotspot/os/linux/os_linux.cpp:1542
    #3  0x00007fd527ac388a in VMError::report_and_die (id=<optimized out>, message=message@entry=0x0, detail_fmt=<optimized out>, detail_args=detail_args@entry=0x7ffef14f0ba8, thread=thread@entry=0x55d76b440d50, 
        pc=pc@entry=0x7fd5271e3056 <CompilationPolicy::can_be_compiled(methodHandle const&, int)+38> "f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230", siginfo=0x7ffef14f0f30, context=0x7ffef14f0e00, 
        filename=<optimized out>, lineno=0, size=0) at ./src/hotspot/share/utilities/vmError.cpp:1635
    #4  0x00007fd527ac40cb in VMError::report_and_die (thread=thread@entry=0x55d76b440d50, sig=sig@entry=11, 
        pc=pc@entry=0x7fd5271e3056 <CompilationPolicy::can_be_compiled(methodHandle const&, int)+38> "f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230", siginfo=siginfo@entry=0x7ffef14f0f30, 
        context=context@entry=0x7ffef14f0e00, detail_fmt=detail_fmt@entry=0x7fd527b848ae "%s") at ./src/hotspot/share/utilities/vmError.cpp:1315
    #5  0x00007fd527ac40fe in VMError::report_and_die (thread=thread@entry=0x55d76b440d50, sig=sig@entry=11, 
        pc=pc@entry=0x7fd5271e3056 <CompilationPolicy::can_be_compiled(methodHandle const&, int)+38> "f\201x(@\037w%\017\267G(\203\350\006f\203\370 w%H\215\025\242\220\230", siginfo=siginfo@entry=0x7ffef14f0f30, 
        context=context@entry=0x7ffef14f0e00) at ./src/hotspot/share/utilities/vmError.cpp:1321
    #6  0x00007fd527800fc2 in JVM_handle_linux_signal (sig=sig@entry=11, info=info@entry=0x7ffef14f0f30, ucVoid=ucVoid@entry=0x7ffef14f0e00, abort_if_unrecognized=abort_if_unrecognized@entry=1)
        at ./src/hotspot/os_cpu/linux_x86/os_linux_x86.cpp:601
    #7  0x00007fd5277f4738 in signalHandler (sig=11, info=0x7ffef14f0f30, uc=0x7ffef14f0e00) at ./src/hotspot/os/linux/os_linux.cpp:4738
    #8  <signal handler called>
    #9  0x00007fd5271e3056 in CompilationPolicy::can_be_compiled (m=..., comp_level=-2) at ./src/hotspot/share/compiler/compilationPolicy.cpp:118
    #10 0x00007fd5271e313d in CompilationPolicy::must_be_compiled (comp_level=-2, m=...) at ./src/hotspot/share/compiler/compilationPolicy.cpp:79
    #11 CompilationPolicy::compile_if_required (selected_method=..., __the_thread__=__the_thread__@entry=0x55d76b440d50) at ./src/hotspot/share/compiler/compilationPolicy.cpp:86
    #12 0x00007fd527685656 in CallInfo::set_common (__the_thread__=<optimized out>, index=15, kind=CallInfo::vtable_call, selected_method=..., resolved_method=..., resolved_klass=0x800149798, this=0x7ffef14f16d0)
        at ./src/hotspot/share/interpreter/linkResolver.cpp:128
    #13 CallInfo::set_virtual (__the_thread__=<optimized out>, vtable_index=15, selected_method=..., resolved_method=..., resolved_klass=0x800149798, this=0x7ffef14f16d0) at ./src/hotspot/share/interpreter/linkResolver.cpp:91
    #14 LinkResolver::runtime_resolve_virtual_method (result=..., resolved_method=..., resolved_klass=<optimized out>, recv=..., recv@entry=..., recv_klass=recv_klass@entry=0x800007438, 
        check_null_and_abstract=check_null_and_abstract@entry=true, __the_thread__=<optimized out>) at ./src/hotspot/share/interpreter/linkResolver.cpp:1424
    #15 0x00007fd527687103 in LinkResolver::resolve_virtual_call (__the_thread__=0x55d76b440d50, check_null_and_abstract=true, link_info=..., receiver_klass=0x800007438, recv=..., result=...)
        at ./src/hotspot/share/interpreter/linkResolver.cpp:1311
    #16 LinkResolver::resolve_invokevirtual (__the_thread__=0x55d76b440d50, index=<optimized out>, pool=..., recv=..., result=...) at ./src/hotspot/share/interpreter/linkResolver.cpp:1689
    #17 LinkResolver::resolve_invoke (result=..., recv=..., pool=..., index=<optimized out>, byte=byte@entry=Bytecodes::_invokevirtual, __the_thread__=__the_thread__@entry=0x55d76b440d50)
        at ./src/hotspot/share/interpreter/linkResolver.cpp:1633
    #18 0x00007fd52742ef88 in InterpreterRuntime::resolve_invoke (thread=thread@entry=0x55d76b440d50, bytecode=Bytecodes::_invokevirtual) at ./src/hotspot/share/interpreter/interpreterRuntime.cpp:854
    #19 0x00007fd52742f567 in InterpreterRuntime::resolve_from_cache (thread=0x55d76b440d50, bytecode=<optimized out>) at ./src/hotspot/share/interpreter/interpreterRuntime.cpp:991
    #20 0x00007fd50efb1aac in ?? ()
    #21 0x00007fd5087300f0 in ?? ()
    #22 0x00007fd50efb1a72 in ?? ()
    #23 0x0000000000000021 in ?? ()
    #24 0x0000000000000000 in ?? ()
    
    public void write(java.lang.String, int, int);
        descriptor: (Ljava/lang/String;II)V
        flags: (0x0001) ACC_PUBLIC
        Code:
          stack=4, locals=6, args_size=4
             0: aload_0
             1: getfield      #97                 // Field lock:Ljava/lang/Object;
             4: dup
             5: astore        4
             7: monitorenter
             8: aload_0
             9: invokevirtual #101                // Method ensureOpen:()V
            12: aload_0
            13: getfield      #43                 // Field out:Ljava/io/Writer;
            16: aload_1
            17: iload_2
            18: iload_3
            19: invokevirtual #136      <--This instruction is crashing          // Method java/io/Writer.write:(Ljava/lang/String;II)V`
            22: aload         4
            24: monitorexit
            25: goto          36
            28: astore        5
            30: aload         4
            32: monitorexit
            33: aload         5
            35: athrow
            36: goto          57
            39: astore        4
            41: invokestatic  #123                // Method java/lang/Thread.currentThread:()Ljava/lang/Thread;
            44: invokevirtual #129                // Method java/lang/Thread.interrupt:()V
            47: goto          57
            50: astore        4
            52: aload_0
            53: iconst_1
            54: putfield      #35                 // Field trouble:Z
            57: return
    
    #include <assert.h>
    #include <jni.h>
    #include <stdio.h>
    #include <stdlib.h>
    
    int main() {
      JavaVM *jvm;
      JNIEnv *env;
      JavaVMInitArgs vm_args;
      JavaVMOption *options = calloc(3, sizeof(JavaVMOption));
      assert(options);
      options[0].optionString = "-Djava.class.path=/usr/lib/java:.";
      options[1].optionString = "-verbose";
      options[2].optionString = "-Xcheck:jni";
      vm_args.version = JNI_VERSION_10;
      vm_args.nOptions = 3;
      vm_args.options = options;
      vm_args.ignoreUnrecognized = 0;
      jint status = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
      assert(status == JNI_OK);
      free(options);
      jclass cls = (*env)->FindClass(env, "A");
      assert(cls == NULL);
      jthrowable throwable = (*env)->ExceptionOccurred(env);
      (*env)->ExceptionDescribe(env);
      if (throwable) {
        (*env)->ExceptionClear(env);
        jclass stringWriter = (*env)->FindClass(env, "java/io/StringWriter");
        assert(stringWriter);
        jclass printWriter = (*env)->FindClass(env, "java/io/PrintWriter");
        assert(printWriter);
        jmethodID noArgsConstructor =
            (*env)->GetMethodID(env, stringWriter, "<init>", "()V");
        assert(noArgsConstructor);
        jmethodID printWriterConstructor =
            (*env)->GetMethodID(env, printWriter, "<init>", "(Ljava/io/Writer;)V");
        assert(printWriterConstructor);
        jobject sw = (*env)->NewObject(env, stringWriter, noArgsConstructor);
        assert(sw);
        jobject pw = (*env)->NewObject(env, printWriter, printWriterConstructor,
                                       printWriter);
        assert(pw);
        jmethodID printStackTrace =
            (*env)->GetMethodID(env, (*env)->GetObjectClass(env, throwable),
                                "printStackTrace", "(Ljava/io/PrintWriter;)V");
        assert(printStackTrace);
        (*env)->CallVoidMethod(env, throwable, printStackTrace, pw);
        jmethodID mid = (*env)->GetMethodID(env, stringWriter, "toString",
                                            "()Ljava/lang/String;");
        printf("%s\n", (*env)->GetStringUTFChars(
                           env, (*env)->CallObjectMethod(env, sw, mid), NULL));
      }
      (*jvm)->DestroyJavaVM(jvm);
    }
    
    jstring string =
            (*env)->CallObjectMethod(env, throwable, printStackTrace, pw);
    
    (*env)->CallObjectMethod(env, throwable, printStackTrace, sw);
    jmethodID mid = (*env)->GetMethodID(env, stringWriter, "toString",
                                            "()Ljava/lang/String;");
    jstring string = (*env)->CallObjectMethod(env, sw, mid);
    
    jobject pw = (*env)->NewObject(env, printWriter, printWriterConstructor,
                                       printWriter);
    
    PrintWriter(Writer w);
    
    PrintWriter(Class<PrintWriter>);
    
    jobject pw = (*env)->NewObject(env, printWriter, printWriterConstructor,
                                       sw);