如何调试dalvik vm crash:类查找Ljava / lang / NullPointerException

时间:2014-03-18 13:02:59

标签: java android dalvik

我有一个纯java(在没有本机代码中)的android应用程序,它在api 7设备上运行时导致dalvik vm崩溃。我还没有看到其他更高版本的设备崩溃。如果我启动我的应用程序而不管它,通常会在10分钟内发生崩溃。

通过java线程转储(这里包含太大而无法包含),大多数线程都处于睡眠状态,而那些线程看起来并不是良性的。

我很习惯在Android平台上调试java问题,但我不知道从哪里开始这样的本机崩溃。

  

03-16 21:19:30.004 E / dalvikvm(6491):VM中止   03-16 21:19:30.014 I / DEBUG(6274): * * * * * * * * * * * * * * * *
  03-16 21:19:30.014 I / DEBUG(6274):构建指纹:&#39; zt180 / zt180 / zt180 /:2.1-update1 / ERE27 / eng.root.20101021.113523:eng / test-keys&#39; <登记/>   03-16 21:19:30.014 I / DEBUG(6274):pid:6491,tid:6514&gt;&gt;&gt; com.dave.myapp&lt;&lt;&lt;
  03-16 21:19:30.014 I / DEBUG(6274):信号11(SIGSEGV),故障添加器deadd00d
  03-16 21:19:30.014 I / DEBUG(6274):r0 00000390 r1 afe135e5 r2 0000000c r3 deadd00d
  03-16 21:19:30.014 I / DEBUG(6274):r4 00000026 r5 0013d250 r6 ad08b368 r7 00000000
  03-16 21:19:30.014 I / DEBUG(6274):r8 ad0103c0 r9 ad089000 10 00000003 fp 492cbed8
  03-16 21:19:30.014 I / DEBUG(6274):ip ad08b570 sp 492cbbe0 lr afe1459d pc ad038a36 cpsr 20000030
  03-16 21:19:31.664 I / DEBUG(6274):#00 pc 00038a36 /system/lib/libdvm.so(dvmAbort)
  03-16 21:19:31.664 I / DEBUG(6274):#01 pc 0005bb6a /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):#02 0005 0005bdde /system/lib/libdvm.so(dvmFindSystemClassNoInit)
  03-16 21:19:31.664 I / DEBUG(6274):#03 pc 0005c2f2 /system/lib/libdvm.so(dvmFindSystemClass)   03-16 21:19:31.664 I / DEBUG(6274):#04 pc 0003820a /system/lib/libdvm.so(dvmThrowChainedException)
  03-16 21:19:31.664 I / DEBUG(6274):#05 pc 000165fc /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):#06 pc 00013f58 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):
  03-16 21:19:31.664 I / DEBUG(6274):pc周围的代码:
  03-16 21:19:31.664 I / DEBUG(6274):ad038a24 4808e9f2 6b9b5823 d0002b00 4b064798
  03-16 21:19:31.664 I / DEBUG(6274):ad038a34 701c2426 ea5ef7d7 00052950 fffe3dfc
  03-16 21:19:31.664 I / DEBUG(6274):ad038a44 fffe7230 00000390 deadd00d b510b40e
  03-16 21:19:31.664 I / DEBUG(6274):
  03-16 21:19:31.664 I / DEBUG(6274):lr周围的代码:
  03-16 21:19:31.664 I / DEBUG(6274):afe1458c 220ce008 2b005eab 1c28d003 47889901
  03-16 21:19:31.664 I / DEBUG(6274):afe1459c 35544306 d5f43f01 2c006824 b003d1ee
  03-16 21:19:31.664 I / DEBUG(6274):afe145ac bdf01c30 00025906 000000bc 1c0fb5f0
  03-16 21:19:31.664 I / DEBUG(6274):
  03-16 21:19:31.664 I / DEBUG(6274):stack:
  03-16 21:19:31.664 I / DEBUG(6274):492cbba0 00000015
  03-16 21:19:31.664 I / DEBUG(6274):492cbba4 afe13615 /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbba8 afe3a0b0 /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbac afe3a05c /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbb0 00000000
  03-16 21:19:31.664 I / DEBUG(6274):492cbbb4 afe1459d /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbb8 492cbbcc
  03-16 21:19:31.664 I / DEBUG(6274):492cbbbc afe135e5 /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbc0 ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbc4 ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbc8 0013d250 [堆]
  03-16 21:19:31.664 I / DEBUG(6274):492cbbcc ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbd0 00000000
  03-16 21:19:31.664 I / DEBUG(6274):492cbbd4 afe13647 /system/lib/libc.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbd8 ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbdc ad038a27 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):#00 492cbbe0 ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbe4 ad05bb6f /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):#01 492cbbe8 42973b52 /data/dalvik-cache/system@framework@core.jar@classes.dex
  03-16 21:19:31.664 I / DEBUG(6274):492cbbec ad08de18 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbf0 ad06e200 /system/lib/libdvm.so
  03-16 21:19:31.664 I / DEBUG(6274):492cbbf4 00000000
  03-16 21:19:31.684 I / DEBUG(6274):492cbbf8 00000000
  03-16 21:19:31.684 I / DEBUG(6274):492cbbfc ad038189 /system/lib/libdvm.so
  03-16 21:19:31.684 I / DEBUG(6274):492cbc00 492cbca8
  03-16 21:19:31.684 I / DEBUG(6274):492cbc04 ad08b368 /system/lib/libdvm.so
  03-16 21:19:31.684 I / DEBUG(6274):492cbc08 ad06e200 /system/lib/libdvm.so
  03-16 21:19:31.684 I / DEBUG(6274):492cbc0c 00000000
  03-16 21:19:31.684 I / DEBUG(6274):492cbc10 00000000
  03-16 21:19:31.684 I / DEBUG(6274):492cbc14 ad05bde3 /system/lib/libdvm.so
  03-16 21:19:38.194 I / ActivityManager(2028):进程com.dave.myapp(pid 6491)已经死亡。

1 个答案:

答案 0 :(得分:0)

从核心转储中,不仅有App Crash,还有 Dalvik VM Crash 。 在查看dalvik源代码之后,程序的崩溃转储是:

  1. dvmAbort()
  2. vm / oo / Class.cpp:findClassNoInit
  3. dvmFindSystemClassNoInit(......)
  4. Android在调用dvmAbort之前,VM转储了一些信息。您可以在 CORE DUMP 之前检查错误。

    代码是:

    /*   
     * We don't expect an exception to be raised at this point.  The
     * exception handling code is good about managing this.  This *can*
     * happen if a JNI lookup fails and the JNI code doesn't do any
     * error checking before doing another class lookup, so we may just
     * want to clear this and restore it on exit.  If we don't, some kinds
     * of failures can't be detected without rearranging other stuff.
     *
     * Most often when we hit this situation it means that something is
     * broken in the VM or in JNI code, so I'm keeping it in place (and
     * making it an informative abort rather than an assert).
     */
    if (dvmCheckException(self)) {
        ALOGE("Class lookup %s attempted with exception pending", descriptor);
        ALOGW("Pending exception is:");
        dvmLogExceptionStackTrace();
        dvmDumpAllThreads(false);
        dvmAbort();
    }