美文网首页
NDK-FFmpeg 报错定位工具arm-linux-andro

NDK-FFmpeg 报错定位工具arm-linux-andro

作者: 杨0612 | 来源:发表于2020-01-10 17:17 被阅读0次

    错误信息如下:

    2020-01-10 16:58:14.332 12136-12161/com.yang.ffmpegmediaplayer A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 12161 (mpegmediaplayer)
    2020-01-10 16:58:14.421 851-1082/? E/WindowManager: performSurfacePlacementInner exit: animating=false
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: Build fingerprint: 'TCL/5099A/A3A_XL_4G:8.0.0/O00623/vJ3N-0:user/release-keys'
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: Revision: '0'
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: ABI: 'arm'
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: pid: 12136, tid: 12161, name: mpegmediaplayer  >>> com.yang.ffmpegmediaplayer <<<
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: Cause: null pointer dereference
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG:     r0 00000000  r1 f42408a5  r2 a4b00040  r3 00000080
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG:     r4 88195970  r5 88195970  r6 88195970  r7 88195938
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG:     r8 00002f68  r9 00000000  sl 88237c7d  fp 00000058
    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG:     ip a9754d60  sp 881958d0  lr a97309cd  pc 88237ce2  cpsr 60070030
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG: backtrace:
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #00 pc 000a1ce2  /data/app/com.yang.ffmpegmediaplayer-AuvcLD7xd8KLTmp6iMQQ2g==/lib/arm/libffmpegmediaplayer.so (_ZN6Player11realPrepareEv+73)
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #01 pc 000a1c8f  /data/app/com.yang.ffmpegmediaplayer-AuvcLD7xd8KLTmp6iMQQ2g==/lib/arm/libffmpegmediaplayer.so (_Z11taskPreparePv+18)
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #02 pc 00047fe7  /system/lib/libc.so (_ZL15__pthread_startPv+22)
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #03 pc 0001af1d  /system/lib/libc.so (__start_thread+32)
    

    从下面这几个关键信息可以看到,是SO库内部出现了空指针。

    2020-01-10 16:58:14.422 12165-12165/? A/DEBUG: Cause: null pointer dereference
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #00 pc 000a1ce2  /data/app/com.yang.ffmpegmediaplayer-AuvcLD7xd8KLTmp6iMQQ2g==/lib/arm/libffmpegmediaplayer.so (_ZN6Player11realPrepareEv+73)
    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #01 pc 000a1c8f  /data/app/com.yang.ffmpegmediaplayer-AuvcLD7xd8KLTmp6iMQQ2g==/lib/arm/libffmpegmediaplayer.so (_Z11taskPreparePv+18)
    

    定位到具体哪一行出现了空指针,可以借助
    arm-linux-androideabi-addr2line工具,它可以将内存地址转换在代码中具体的某一行。该工具在sdk\ndk目录下,我的路径大概是:sdk\ndk\20.1.5948944\toolchains\arm-linux-androideabi-4.9\prebuilt\windows-x86_64\bin。可以把它配置到系统环境变量中,方便使用。

    在Android Studio Terminal中输入命令,就能定位报错的具体位置,得到结果如下:

    arm-linux-androideabi-addr2line -C -f -e D:\private\AndroidProject\FFmpegMediaPlayer\app\build\intermediates\cmake\debug\obj\armeabi-v7a\libffmpegmediaplayer.so 000a1ce2
    Player::realPrepare()
    D:/private/AndroidProject/FFmpegMediaPlayer/app/src/main/cpp/Player.cpp:42
    

    这里是Player.cpp文件第42行出现了空指针。

    arm-linux-androideabi-addr2line命令主要有两个参数:

    D:\private\AndroidProject\FFmpegMediaPlayer\app\build\intermediates\cmake\debug\obj\armeabi-v7a\libffmpegmediaplayer.so,这是SO库的路径
    000a1ce2,是内存地址,2020-01-10 16:58:14.427 12165-12165/? A/DEBUG: #00 pc后面的“000a1ce2”就是内存地址

    2020-01-10 16:58:14.427 12165-12165/? A/DEBUG:     #00 pc 000a1ce2  /data/app/com.yang.ffmpegmediaplayer-AuvcLD7xd8KLTmp6iMQQ2g==/lib/arm/libffmpegmediaplayer.so (_ZN6Player11realPrepareEv+73)
    

    相关文章

      网友评论

          本文标题:NDK-FFmpeg 报错定位工具arm-linux-andro

          本文链接:https://www.haomeiwen.com/subject/jphmactx.html