GithubHelp home page GithubHelp logo

iqiyi / xcrash Goto Github PK

View Code? Open in Web Editor NEW
3.6K 92.0 603.0 2.85 MB

🔥 xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.

License: Other

Java 12.45% C 87.35% CMake 0.21%
android crash-reporting native crash java exception handler reporting reporter jni

xcrash's Introduction

xCrash Logo

xCrash

xCrash provides the Android app with the ability to capture java crash, native crash and ANR. No root permission or any system permissions are required.

intro

xCrash can generate a tombstone file (similar format as Android system's tombstone file) in the directory you specified when the app process crashes or ANRs.

xCrash has been used in many Android apps (including iQIYI video) on different platforms (mobile, tablet, TV) of iQIYI for many years.

README 中文版

Features

  • Support Android 4.1 - 11 (API level 16 - 30).
  • Support armeabi-v7a, arm64-v8a, x86 and x86_64.
  • Capturing java crash, native crash and ANR.
  • Dumping detailed statistics about process, threads, memory, FD and network.
  • Setting which thread's info should be dumped via regular expressions.
  • Do not require root permission or any system permissions.

Tombstone File Previews

Overview Maps

Architecture

architecture

Capture Native Crash

capture native crash

Capture ANR

capture anr

Usage

1. Add dependency.

dependencies {
    implementation 'com.iqiyi.xcrash:xcrash-android-lib:3.0.0'
}

2. Specify one or more ABI(s) you need.

android {
    defaultConfig {
        ndk {
            abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
        }
    }
}

3. Initialize xCrash.

Java

public class MyCustomApplication extends Application {

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        
        xcrash.XCrash.init(this);
    }
}

Kotlin

class MyCustomApplication : Application() {

    override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)

        xcrash.XCrash.init(this)
    }
}

Tombstone files will be written to Context#getFilesDir() + "/tombstones" directory by default. (usually in: /data/data/PACKAGE_NAME/files/tombstones)

There is a more practical and complex sample app in the xcrash_sample folder.

Build

If you want to build xCrash from source code. Follow this guide:

Build AAR library.

./gradlew :xcrash_lib:build

Support

Contributing

See xCrash Contributing Guide.

License

xCrash is MIT licensed, as found in the LICENSE file.

xCrash documentation is Creative Commons licensed, as found in the LICENSE-docs file.

xcrash's People

Contributors

caikelun avatar simpleton avatar timgates42 avatar vhow avatar xuqnqn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xcrash's Issues

建议将日志默认保存到SD卡Android/data目录

非常感谢各位开源的xCrash方案,如果有想进一步了解原理的可以看看这篇文章

虽然将日志保存到应用的内部存储目录(/data/data/pkg/files/tombstones),可以避免申请权限,但如果此时设备无法使用网络,则无法将日志上传server端,release版本也没法直接获取日志。

建议将日志默认目录修改到Android/data/pkg/files/tombstones目录(getExternalFilesDir("tombstones").absolutePath),该目录同样可以避免申请SD卡读写权限,而且也能保证用户可以将日志从手机上拷贝出来。

诚然,在文档上有说明getExternalFilesDir有可能返回null,从当前来说几乎没有不带存储的设备了,为了避免这种极端的null,可以类似先判断,如果是null则存到App的私有data目录,反之则存到SD卡上。

val externalFolder = getExternalFilesDir("tombstones")
if (externalFolder != null) {
parameters.setLogDir(externalFolder.absolutePath)

}

X86机型只使用armeabi-v7a的so包,native crash无法获取crash内容

07-08 19:29:30.999 22781-22781/? E/xcrash_dumper: THREAD: ptrace GETREGS failed, errno=16
07-08 19:29:31.001 22781-22781/? E/xcrash_dumper: THREAD: ptrace GETREGS failed, errno=16
07-08 19:29:31.004 22781-22781/? E/xcrash_dumper: THREAD: ptrace GETREGS failed, errno=16
07-08 19:29:31.006 22781-22781/? E/xcrash_dumper: THREAD: ptrace GETREGS failed, errno=16

连续发生多个未捕获异常时的奇怪问题

最近在处理设备异常捕获时,由于ROM经过定制,发现如果快速发生两个以上未捕获异常,会导致XCrash无法捕获,或是刚进入void onCrash(String logPath, String emergency)方法,会自动中断执行,导致后续杀死进程和重启应用的代码不会执行,请问是否有机制可以将异常按队列方式进行处理,万望回复,十分感谢!!!

为什么不用cmake呢?

为什么不用cmake呢?是因为dumper是个可执行程序的原因吗?如果放在AndroidStudio里是不是编译就有问题,如果单独用命令执行,也需要有个重命名的过程?

无法捕获启动后台进程Service产生的ANR

android 8.1
我构造了一个Service启动相关的ANR在独立的进程。
在开发者选项中打开所有显示所有ANR后,可以看到ANR发生,
但是ANRCallback没有回调。

主进程UI事件分发类ANR测试正常

是否支持只集成native捕获部分

因为目前团队采用acra+breakpad方案,对于java部分的崩溃,现有方案基本没什么问题;但对于native崩溃,目前效果还不是很好,从dmp文件解析出的内容,大多是系统相关信息,业务堆栈有限。所以想优化下native部分。App中RN页面较多

目前native的堆栈类似,较多系统so,大部分出现在RN页面
libc.so NativeException: Operating system: Android
0.0.0 Linux 4.4.21-perf+ #1 SMP PREEMPT Wed Sep 12 23:34:33 CST 2018 armv8l
CPU: arm
ARMv1 Qualcomm part(0x51008010) features: half,thumb,fastmult,vfpv2,edsp,neon,vfpv3,tls,vfpv4,idiva,idivt
8 CPUs
GPU: UNKNOWN
Crash reason: SIGABRT
Crash address: 0x3fe1
Process uptime: not available
Thread 21 (crashed)
0 libc.so + 0x4a988
r0 = 0x00000000 r1 = 0x00004017 r2 = 0x00000006 r3 = 0x00000008
r4 = 0xd2eeb978 r5 = 0x00000006 r6 = 0xd2eeb920 r7 = 0x0000010c
r8 = 0xb8289080 r9 = 0x00000000 r10 = 0xf26600f8 r12 = 0x0000000c
fp = 0xf26600fc sp = 0xd2eeaf30 lr = 0xf531d06f pc = 0xf531f988
Found by: given as instruction pointer in context
1 libc.so + 0x1dacf
sp = 0xd2eeaf48 pc = 0xf52f2ad1
Found by: stack scanning
2 libc.so + 0x194c7
sp = 0xd2eeaf50 pc = 0xf52ee4c9
Found by: stack scanning
3 libhwui.so + 0x745cd
sp = 0xd2eeaf5c pc = 0xf5c985cf
Found by: stack scanning
4 libhwui.so + 0x745cd
sp = 0xd2eeaf6c pc = 0xf5c985cf
Found by: stack scanning
5 libc.so + 0x17522
sp = 0xd2eeaf78 pc = 0xf52ec524
3Found by: stack scanning
...

刚接触xCrash,想咨询下,对于上述的这种情况,集成xcrash会有提升么? 另外,xcrash是否支持单独集成native crash信息采集的部分呢? 感谢~

native crash happened on android 10

dump status:
child terminated normally with non-zero exit status(102)


Start time: '2020-10-28T00:52:16.530-0300'
Crash time: '2020-10-28T02:47:40.345-0300'
App ID: 'com..'
App version: '7.5.74'
Rooted: 'No'
API level: '29'
OS version: '10'
Kernel version: 'Linux version 4.9.206-perf+ #1 SMP PREEMPT Wed Sep 30 23:50:55 CDT 2020 (aarch64)'
ABI list: 'arm64-v8a,armeabi-v7a,armeabi'
Manufacturer: 'motorola'
Brand: 'motorola'
Model: 'moto g(7) power'
Build fingerprint: 'motorola/ocean_t/ocean_t:10/QPOS30.52-29-9/0c526b:user/release-keys'
ABI: 'arm64'
pid: 32393, tid: 32418, name: xcrash_trace_dp >>> com.. <<<
signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
x0 0000000000000000 x1 0000000000007ea2 x2 0000000000000006 x3 00000070c0e62080
x4 00000070a53147c0 x5 00000070a53147c0 x6 00000070a53147c0 x7 00000070c1ea9240
x8 00000000000000f0 x9 900c3b2804db1c32 x10 0000000000000001 x11 0000000000000000
x12 fffffff0fffffbdf x13 000000711b97d740 x14 0000000000000001 x15 404511a01c84f6c1
x16 00000071af4f38c0 x17 00000071af4d1020 x18 00000070c0172000 x19 0000000000007e89
x20 0000000000007ea2 x21 00000000ffffffff x22 00000070a8e5b4c0 x23 000000712c5d5835
x24 000000712c5f749e x25 0000000000000001 x26 000000712cbf7258 x27 00000071b225c880
x28 0000000000000000 x29 00000070c0e62120
sp 00000070c0e62060 lr 00000071af485f88 pc 00000071af485fb4

backtrace:
#00 pc 0000000000082fb4 /apex/com.android.runtime/lib64/bionic/libc.so (abort+160)
#1 pc 00000000004b4850 /apex/com.android.runtime/lib64/libart.so (_ZN3art7Runtime5AbortEPKc+2272)
#2 pc 000000000000c5b8 /system/lib64/libbase.so (_ZN7android4base10LogMessageD1Ev+612)
#3 pc 0000000000442f54 /apex/com.android.runtime/lib64/libart.so (_ZNK3art9OatHeader17GetCompilerFilterEv+284)
#4 pc 000000000044a84c /apex/com.android.runtime/lib64/libart.so (_ZNK3art7OatFile17GetCompilerFilterEv+44)
#5 pc 0000000000455d00 /apex/com.android.runtime/lib64/libart.so (_ZN3art14OatFileManager14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+380)
#6 pc 00000000004c1d40 /apex/com.android.runtime/lib64/libart.so (_ZN3art7Runtime14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+108)
#7 pc 000000000000648c /data/app/com..-HCMqtsa_bMSx6IjK9XhC8A==/lib/arm64/libxcrash.so
#8 pc 00000000000e2060 /apex/com.android.runtime/lib64/bionic/libc.so
#9 pc 0000000000084af4 /apex/com.android.runtime/lib64/bionic/libc.so
#10 pc 0000000000000000

java stacktrace:
(no managed stack frames)

memory info:
System Summary (From: /proc/meminfo)
MemTotal: 3659320 kB
MemFree: 26988 kB
MemAvailable: 372516 kB
Buffers: 364 kB
Cached: 432912 kB
SwapCached: 11820 kB
Active: 1423040 kB
Inactive: 580504 kB
Active(anon): 1261180 kB
Inactive(anon): 417984 kB
Active(file): 161860 kB
Inactive(file): 162520 kB
Unevictable: 56648 kB
Mlocked: 56648 kB
SwapTotal: 1048572 kB
SwapFree: 12320 kB
Dirty: 820 kB
Writeback: 36 kB
AnonPages: 1623164 kB
Mapped: 360252 kB
Shmem: 51428 kB
Slab: 342536 kB
SReclaimable: 88548 kB
SUnreclaim: 253988 kB
KernelStack: 67440 kB
PageTables: 86708 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 2878232 kB
Committed_AS: 58449580 kB
VmallocTotal: 263061440 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
CmaTotal: 258048 kB
CmaFree: 0 kB

Process Status (From: /proc/PID/status)
Name: com..
Umask: 0077
State: D (disk sleep)
Tgid: 32393
Ngid: 0
Pid: 32393
PPid: 984
TracerPid: 0
Uid: 10273 10273 10273 10273
Gid: 10273 10273 10273 10273
FDSize: 512
Groups: 3001 3002 3003 9997 20273 50273
VmPeak: 10103188 kB
VmSize: 9672364 kB
VmLck: 0 kB
VmPin: 0 kB
VmHWM: 384028 kB
VmRSS: 179528 kB
RssAnon: 127732 kB
RssFile: 42300 kB
RssShmem: 9496 kB
VmData: 1570940 kB
VmStk: 8192 kB
VmExe: 28 kB
VmLib: 221692 kB
VmPTE: 3360 kB
VmPMD: 52 kB
VmSwap: 47632 kB
Threads: 252
SigQ: 3/13161
SigPnd: 0000000000000000
ShdPnd: 0000000000000000
SigBlk: 0000000080001200
SigIgn: 0000000000000001
SigCgt: 0000000e400084fc
CapInh: 0000000000000000
CapPrm: 0000000000000000
CapEff: 0000000000000000
CapBnd: 0000000000000000
CapAmb: 0000000000000000
Seccomp: 2
Speculation_Store_Bypass: unknown
Cpus_allowed: ff
Cpus_allowed_list: 0-7
Mems_allowed: 1
Mems_allowed_list: 0
voluntary_ctxt_switches: 575033
nonvoluntary_ctxt_switches: 808913

Process Limits (From: /proc/PID/limits)
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 13161 13161 processes
Max open files 32768 32768 files
Max locked memory 67108864 67108864 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 13161 13161 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 40 40
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us

Process Details (From: /proc/PID/smaps)
Pss Pss Shared Private Shared Private SwapPss
Total Clean Dirty Dirty Clean Clean Dirty
------ ------ ------ ------ ------ ------ ------
Native Heap 74234 0 500 74224 0 0 29594
Dalvik Heap 0 0 0 0 0 0 0
Stack 60 0 4 60 0 0 24
Cursor 416 0 0 416 0 0 0
Ashmem 4 0 0 4 20 0 0
Gfx dev 7272 0 0 7272 0 0 0
Other dev 32 0 180 0 0 32 0
.so mmap 7004 3820 1888 1400 14400 3820 519
.jar mmap 868 324 0 0 6748 324 0
.apk mmap 529 332 0 60 628 332 140
.dex mmap 9317 9272 0 28 60 9272 0
.oat mmap 772 96 0 64 14780 96 0
.art mmap 3690 0 9436 3480 40 0 85
Other mmap 5896 0 6876 2028 380 388 0
Unknown 60773 0 788 60756 0 0 10133
TOTAL 211362 13844 19672 149792 37056 14264 40495

Process Dalvik Details (From: /proc/PID/smaps)
.Boot vdex 54 52 0 0 12 52 0
.App dex 77 36 0 28 40 36 0
.App vdex 9186 9184 0 0 8 9184 0
.Boot art 3690 0 9436 3480 40 0 85

Process Summary (From: /proc/PID/smaps)
Pss(KB)
------
Java Heap: 3480
Native Heap: 74224
Code: 15396
Stack: 60
Private Other: 70896
System: 47306
TOTAL: 211362 TOTAL SWAP PSS: 40495

memory info:
Process Summary (From: android.os.Debug.MemoryInfo)
Pss(KB)
------
Java Heap: 50440
Native Heap: 77584
Code: 16648
Stack: 60
Graphics: 10752
Private Other: 17600
System: 47317
TOTAL: 220401 TOTAL SWAP: 46972

foreground:
no

xcrash_sample 在5.0以上设备ANR没有回调

xcrash_sample 在系统5.0以上的设备 没有走ICrashCallback回调 麻烦帮忙看下
log下是显示
xcrash.sample Thread[3,tid=6022,WaitingInMainSignalCatcherLoop,Thread*=0x707d45ca00,peer=0x16702970,"Signal Catcher"]: reacting to signal 3
/xcrash.sample I/zygote64: Wrote stack traces to '/data/anr/traces.txt'

4.x是正常的

有ANR异常捕获吗

ANR异常捕获应该还比较好获得的吧,这个功能在Xcrash上支持吗

在自定义的信号处理函数中是否有必要兼容其他的信号处理函数呢

我看Tencent Bugly里面会对其他信号处理进行兼容:

static void my_handler(const int code, siginfo_t *const si, void *const sc) {
...  
  /* Call previous handler. */  
  old_handler.sa_sigaction(code, si, sc);  
}

参考他们的文章:https://zhuanlan.zhihu.com/p/27834417

某些信号可能在之前已经被安装过信号处理函数,而sigaction一个信号量只能注册一个处理函数,这意味着我们的处理函数会覆盖其他人的处理信号
保存旧的处理函数,在处理完我们的信号处理函数后,在重新运行老的处理函数就能完成兼容。

所以在xcd_core_signal_handler里是否需要回调旧的信号处理函数呢?

你好,请教一个编译问题lzma

因为android.mk不熟,我把项目转成了cmake,但是编译的时候包如下错误。

libxcrash_dumper/lzma/./Threads.h:18:9: error: unknown type name 'HANDLE'
typedef HANDLE CThread;
^

说HANDLE找不到,搜索确实没有,不知道为什么。我下载lzma的代码也不行。

macos
as3.4.1
ndk最新的

xcrash_sample在5.0以上的机型 ANR 不走callback

4.x的机型是OK的 会走callback
5.x以上(我用的是8.0)不走callback anr时locat打出来日志
/xcrash.sample I/zygote64: Thread[3,tid=6022,WaitingInMainSignalCatcherLoop,Thread*=0x707d45ca00,peer=0x16702970,"Signal Catcher"]: reacting to signal 3
/xcrash.sample I/zygote64: Wrote stack traces to '/data/anr/traces.txt'

Task :xcrash_lib:checkstyle FAILED

我编译的时候,报这种错误

Task :xcrash_lib:checkstyle FAILED
[ant:checkstyle] [ERROR] D:\Dev.space\xCrash-master_bak\xCrash-master\src\java\xcrash\xcrash_lib\src\main\java\xcrash\ActivityMonitor.java:1: 文件未以空行结尾▒? [NewlineAtEndOfFile]
[ant:checkstyle] [ERROR] D:\Dev.space\xCrash-master_bak\xCrash-master\src\java\xcrash\xcrash_lib\src\main\java\xcrash\AnrHandler.java:1: 文件未以空行结尾▒? [NewlineAtEndOfFile]
[ant:checkstyle] [ERROR] D:\Dev.space\xCrash-master_bak\xCrash-master\src\java\xcrash\xcrash_lib\src\main\java\xcrash\DefaultLogger.java:1: 文件未以空行结尾▒? [NewlineAtEndOfFile]
[ant:checkstyle] [ERROR] D:\Dev.space\xCrash-master_bak\xCrash-master\src\java\xcrash\xcrash_lib\src\main\java\xcrash\Errno.java:1: 文件未以空行结尾▒? [NewlineAtEndOfFile]

可以不使用dumper么?

如果不使用dumper,直接通过xc_fallback_get_emergency 会有什么区别么?
xc_fallback_get_emergency会有数据不全,或者信息不全的问题么?

dumper怎么使用呀?

我发现集成好之后,在指定目录下输出的内容是可读的文本格式,那么dump是用来做什么的呀,是用来压缩加密的吗?还是

java代码混淆后crash还原的代码行号不对

这里加了混淆,修改了一下测试用例testJavaCrash,但发现混淆后堆栈的代码行号不对。如下:
crash:trace

        ...
     Caused by: java.lang.RuntimeException: test java exception
        at a.l.a(XCrash.java:44)
        at xcrash.sample.MainActivity.testJavaCrashInMainThread_onClick(MainActivity.java:1)
        at java.lang.reflect.Method.invoke(Native Method) 
        at androidx.appcompat.app.AppCompatViewInflater$DeclaredOnClickListener.onClick(AppCompatViewInflater.java:3) 
        ...

这里面还原的几个行号都比较奇怪,如at a.l.a(XCrash.java:44)这个44行
apk
smali文件

开启ANR检测功能是不是也会捕获普通卡顿

非常感谢贵厂的库。
使用中遇到个问题:开启ANR功能后,普通的卡顿也会上传, 主线程被短暂卡顿也会上传一个anr日志,导致线上传回的日志非常多。
有没有接口可以调整这个卡顿检测的时间阈值 ?

ANR在5.0前后采用不同的实现

ANR在5.0之间的版本通过Observe /data/anr变化来实现,为什么没有跟5.0之后一样,通过捕获信号量来实现?谢谢!

xcrash_sample native crash double catches

First of all, thank you for your work. And then the issue:

Description

When test "native crash (in another process)", it cause double times crashes/catches, create 2 tombstones in seconds.

Detail

I compared that files, they have different catch pid, tid, and some random memory addr, and later one have following stack additionally:

    stack:
    ...
    00000074d963c000-00000074d963d000 ---       0     1000 [anon:thread signal stack guard]
    00000074d963d000-00000074d9641000 rw-       0     4000 [anon:thread signal stack]
    ...
    00000074d96fa000-00000074d96fb000 ---       0     1000 [anon:bionic TLS guard]
    00000074d96fb000-00000074d96fe000 rw-       0     3000 [anon:bionic TLS]
    00000074d96fe000-00000074d96ff000 ---       0     1000 [anon:bionic TLS guard]
    ...

Question

Is it a feature or something else?

Ubuntu环境下编译native出错

系统环境:
Linux version 4.15.0-42-generic (buildd@lgw01-amd64-023) (gcc version 7.3.0 (Ubuntu 7.3.0-16ubuntu3)) #45-Ubuntu SMP Thu Nov 15 19:32:57 UTC 2018
NDK版本:21.0.6113669
编译时提示:
src/native/libxcrash/jni/xc_crash.c:464:13: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
src/native/libxcrash_dumper/jni/lzma/Bra.c:37:24: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
src/native/libxcrash_dumper/jni/lzma/Bra.c:58:24: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt]
2020-09-21_113435

一定需要ndk-R16b?可以用更高版本的NDK吗?或者低版本?

编译环境mac, ndk/android-ndk-r10e

localhost:~ shx$ ndk-build --version
GNU Make 3.81
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

localhost:native shx$ ./build.sh
make: Entering directory /Users/didi/Downloads/xCrash-master/src/native/libxcrash/jni' [armeabi] Compile thumb : xcrash <= xc_jni.c arm-linux-androideabi-gcc: error: unrecognized command line option '-Weverything' make: *** [/Users/didi/Downloads/xCrash-master/src/native/libxcrash/obj/local/armeabi/objs/xcrash/xc_jni.o] Error 1 make: Leaving directory /Users/didi/Downloads/xCrash-master/src/native/libxcrash/jni'
make: Entering directory /Users/didi/Downloads/xCrash-master/src/native/libxcrash_dumper/jni' [armeabi] Compile thumb : xcrash_dumper <= xcd_arm_exidx.c arm-linux-androideabi-gcc: error: unrecognized command line option '-Weverything' make: *** [/Users/didi/Downloads/xCrash-master/src/native/libxcrash_dumper/obj/local/armeabi/objs/xcrash_dumper//Users/didi/Downloads/xCrash-master/src/native/libxcrash_dumper/jni/xcd_arm_exidx.o] Error 1 make: Leaving directory /Users/didi/Downloads/xCrash-master/src/native/libxcrash_dumper/jni'
localhost:native didi$ cat build.sh
#!/bin/bash

localhost:shx$ whereis ndk-build
localhost:
shx$ whereis ndk-build

ANR DumpForSigQuit 遇到ART abort

发现xCrash 在处理ANR时,调用art 的 DumpForSigQuit 有比较大的crash 概率,下面是一个比较常见的crash backtrace. 而且绝大部分是发生在anroid 9上,art在dump java stack时发生循环abort了

backtrace <<<
#00 pc 0001d796 /system/lib/libc.so (abort+57)
#1 pc 0037160b /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+950)
#2 pc 0000720b /system/lib/libbase.so (_ZN7android4base10LogMessageD2Ev+578)
#3 pc 003c526b /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20GetMethodIdxOfInvokeEPKNS_11InstructionE+210)
#4 pc 003c3f01 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20VerifyInvocationArgsEPKNS_11InstructionENS0_10MethodTypeEb+28)
#5 pc 003bd1bf /system/lib/libart.so (_ZN3art8verifier14MethodVerifier25CodeFlowVerifyInstructionEPj+5486)
#6 pc 003bb9bf /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20CodeFlowVerifyMethodEv+214)
#7 pc 003ba3c9 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier14VerifyCodeFlowEv+576)
#8 pc 003b887b /system/lib/libart.so (_ZN3art8verifier14MethodVerifier6VerifyEv+5798)
#9 pc 003b9bb9 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier16FindLocksAtDexPcEv+88)
#10 pc 003b9af7 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier16FindLocksAtDexPcEPNS_9ArtMethodEjPNSt3__16vectorINS1_11DexLockInfoENS4_9allocatorIS6_EEEE+378)
#11 pc 002ebe85 /system/lib/libart.so (_ZN3art7Monitor10VisitLocksEPNS_12StackVisitorEPFvPNS_6mirror6ObjectEPvES6_b+296)
#12 pc 003a0a7f /system/lib/libart.so (_ZN3art26MonitorObjectsStackVisitor10VisitFrameEv+98)
#13 pc 00385c23 /system/lib/libart.so (_ZN3art12StackVisitor9WalkStackILNS0_16CountTransitionsE0EEEvb+506)
#14 pc 0039715f /system/lib/libart.so (_ZNK3art6Thread13DumpJavaStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbb+222)
#15 pc 00393bdf /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+226)
#16 pc 003901af /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
#17 pc 003a9a77 /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+654)
#18 pc 003a3ed9 /system/lib/libart.so (ZN3art10ThreadList13RunCheckpointEPNS_7ClosureES2+1152)
#19 pc 003a30d1 /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+384)
#20 pc 003713af /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+346)
#21 pc 0000720b /system/lib/libbase.so (_ZN7android4base10LogMessageD2Ev+578)
#22 pc 003c526b /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20GetMethodIdxOfInvokeEPKNS_11InstructionE+210)
#23 pc 003c3f01 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20VerifyInvocationArgsEPKNS_11InstructionENS0_10MethodTypeEb+28)
#24 pc 003bd1bf /system/lib/libart.so (_ZN3art8verifier14MethodVerifier25CodeFlowVerifyInstructionEPj+5486)
#25 pc 003bb9bf /system/lib/libart.so (_ZN3art8verifier14MethodVerifier20CodeFlowVerifyMethodEv+214)
#26 pc 003ba3c9 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier14VerifyCodeFlowEv+576)
#27 pc 003b887b /system/lib/libart.so (_ZN3art8verifier14MethodVerifier6VerifyEv+5798)
#28 pc 003b9bb9 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier16FindLocksAtDexPcEv+88)
#29 pc 003b9af7 /system/lib/libart.so (_ZN3art8verifier14MethodVerifier16FindLocksAtDexPcEPNS_9ArtMethodEjPNSt3__16vectorINS1_11DexLockInfoENS4_9allocatorIS6_EEEE+378)
#30 pc 002ebe85 /system/lib/libart.so (_ZN3art7Monitor10VisitLocksEPNS_12StackVisitorEPFvPNS_6mirror6ObjectEPvES6_b+296)
#31 pc 003a0a7f /system/lib/libart.so (_ZN3art26MonitorObjectsStackVisitor10VisitFrameEv+98)
#32 pc 00385c23 /system/lib/libart.so (_ZN3art12StackVisitor9WalkStackILNS0_16CountTransitionsE0EEEvb+506)
#33 pc 0039715f /system/lib/libart.so (_ZNK3art6Thread13DumpJavaStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbb+222)
#34 pc 00393bdf /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+226)
#35 pc 003901af /system/lib/libart.so (_ZNK3art6Thread4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMapb+34)
#36 pc 003a9a77 /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+654)
#37 pc 003a3ed9 /system/lib/libart.so (ZN3art10ThreadList13RunCheckpointEPNS_7ClosureES2+1152)
#38 pc 003a3269 /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+792)
#39 pc 003a2e7b /system/lib/libart.so (_ZN3art10ThreadList14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+650)
#40 pc 0037bdb9 /system/lib/libart.so (_ZN3art7Runtime14DumpForSigQuitERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+120)
#41 pc 000054d3 /data/app/com.xxx.yyy-cqz0wiwhy9CKKL7O9TNArg==/lib/arm/libxcrash.so
#42 pc 00065ac7 /system/lib/libc.so (_ZL15__pthread_startPv+22)
#43 pc 0001e9ad /system/lib/libc.so (__start_thread+32)

How about Android11 support?

As we know, Android11 has been released several weeks ago, so I want to know can it(xCrash) work in Android11?

无法及时捕获的traces信息

接入之后,发现发生ANR时,不能及时捕获的traces信息,要等到第二次ANR时才能捕获到,有什么因素会干扰XCrash捕获ANR呢,在demo中接入时可以及时捕获到

通过线程名获取java堆栈

image
想了解下目前你们线上的数据情况,获取java堆栈失败的情况占多少?如果两个线程名类似(例如线程池默认的名字)应该会上报两个Thread的java堆栈了吧

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.