Skip to content

[Android] Improve native stack traces when the app crashes because of a signal on CoreCLR #114436

Open
@grendello

Description

@grendello

Whenever an Android app which uses CoreCLR crashes because of a signal, the Android OS
tries to walk the stack, symbolicate it etc. While it works as expected with the MonoVM runtime, with CoreCLR it produces stack traces similar to the one below:

04-09 13:18:42.901 19038 19038 F libc    : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 19038 (in.mauiperftest), pid 19038 (in.mauiperftest)
04-09 13:18:42.994 19058 19058 I crash_dump64: performing dump of process 19038 (target tid = 19038)
04-09 13:18:43.166 19058 19058 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-09 13:18:43.166 19058 19058 F DEBUG   : Build fingerprint: 'google/shiba/shiba:15/BP1A.250305.019/13003188:user/release-keys'
04-09 13:18:43.166 19058 19058 F DEBUG   : Revision: 'MP1.0'
04-09 13:18:43.166 19058 19058 F DEBUG   : ABI: 'arm64'
04-09 13:18:43.166 19058 19058 F DEBUG   : Timestamp: 2025-04-09 13:18:43.000718311+0200
04-09 13:18:43.166 19058 19058 F DEBUG   : Process uptime: 1s
04-09 13:18:43.166 19058 19058 F DEBUG   : Cmdline: com.xamarin.mauiperftest
04-09 13:18:43.166 19058 19058 F DEBUG   : pid: 19038, tid: 19038, name: in.mauiperftest  >>> com.xamarin.mauiperftest <<<
04-09 13:18:43.166 19058 19058 F DEBUG   : uid: 10327
04-09 13:18:43.166 19058 19058 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
04-09 13:18:43.166 19058 19058 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
04-09 13:18:43.166 19058 19058 F DEBUG   : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000000000000000
04-09 13:18:43.166 19058 19058 F DEBUG   : Cause: null pointer dereference
04-09 13:18:43.166 19058 19058 F DEBUG   :     x0  0000007fde37f7a0  x1  0000007fde37f700  x2  ffffffffffffffd0  x3  0000007fde37fb20
04-09 13:18:43.166 19058 19058 F DEBUG   :     x4  0000007fde381b50  x5  0000007fde37fb80  x6  0000000000000010  x7  7f7f7f7f7f7f7f7f
04-09 13:18:43.166 19058 19058 F DEBUG   :     x8  0000000000000000  x9  0000000000000000  x10 0000000000000000  x11 00000000d7ffffff
04-09 13:18:43.166 19058 19058 F DEBUG   :     x12 0000000000000039  x13 0000000000000033  x14 0000000000000000  x15 0000000000000000
04-09 13:18:43.166 19058 19058 F DEBUG   :     x16 00000072be9d11d0  x17 0000007683154040  x18 000000769201c000  x19 0000007fde37fbc0
04-09 13:18:43.166 19058 19058 F DEBUG   :     x20 0000007690fcca40  x21 0000000000000000  x22 0000000000008500  x23 0000007fde381600
04-09 13:18:43.166 19058 19058 F DEBUG   :     x24 0000000000000001  x25 0000007fde380190  x26 00000072be19b874  x27 0000000000000000
04-09 13:18:43.166 19058 19058 F DEBUG   :     x28 0000000000000000  x29 0000007fde37f6c0
04-09 13:18:43.166 19058 19058 F DEBUG   :     lr  00000072be5ac3e8  sp  0000007fde37eb00  pc  00000072be8d6328  pst 0000000060001000
04-09 13:18:43.166 19058 19058 F DEBUG   : 1 total frames
04-09 13:18:43.166 19058 19058 F DEBUG   : backtrace:
04-09 13:18:43.166 19058 19058 F DEBUG   :       #00 pc 00000000006dd328  /data/app/~~NNfnqZaOSoD5ncU1_n1GtA==/com.xamarin.mauiperftest-BjQLxm0BIF73sfoR-qJ5fg==/base.apk (offset 0xdf9000)

The attached sample app triggers a SIGABRT from managed code, when built and ran with dotnet run -c Release and the main branch of .NET for Android. The resulting trace is as follows:

04-09 13:44:47.573 20605 20605 F libc    : Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 20605 (anyname.sigabrt), pid 20605 (anyname.sigabrt)
04-09 13:44:47.694 20637 20637 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
04-09 13:44:47.694 20637 20637 F DEBUG   : Build fingerprint: 'google/shiba/shiba:15/BP1A.250305.019/13003188:user/release-keys'
04-09 13:44:47.694 20637 20637 F DEBUG   : Revision: 'MP1.0'
04-09 13:44:47.694 20637 20637 F DEBUG   : ABI: 'arm64'
04-09 13:44:47.694 20637 20637 F DEBUG   : Timestamp: 2025-04-09 13:44:47.609623413+0200
04-09 13:44:47.694 20637 20637 F DEBUG   : Process uptime: 1s
04-09 13:44:47.694 20637 20637 F DEBUG   : Cmdline: com.companyname.sigabrt
04-09 13:44:47.694 20637 20637 F DEBUG   : pid: 20605, tid: 20605, name: anyname.sigabrt  >>> com.companyname.sigabrt <<<
04-09 13:44:47.694 20637 20637 F DEBUG   : uid: 10299
04-09 13:44:47.694 20637 20637 F DEBUG   : tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
04-09 13:44:47.694 20637 20637 F DEBUG   : pac_enabled_keys: 000000000000000f (PR_PAC_APIAKEY, PR_PAC_APIBKEY, PR_PAC_APDAKEY, PR_PAC_APDBKEY)
04-09 13:44:47.694 20637 20637 F DEBUG   : signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
04-09 13:44:47.694 20637 20637 F DEBUG   : Abort message: 'Aborting process.'
04-09 13:44:47.694 20637 20637 F DEBUG   :     x0  0000000000000000  x1  000000000000507d  x2  0000000000000006  x3  0000007fde37f760
04-09 13:44:47.694 20637 20637 F DEBUG   :     x4  0000000000000010  x5  0000000000000010  x6  0000000000000010  x7  ff7fffff7f7f7fff
04-09 13:44:47.694 20637 20637 F DEBUG   :     x8  00000000000000f0  x9  d973eca66f6e5290  x10 0000000000000001  x11 0000007683171900
04-09 13:44:47.694 20637 20637 F DEBUG   :     x12 0000000067f65daf  x13 000000007fffffff  x14 0000000000193f0c  x15 0000004c7587f35c
04-09 13:44:47.694 20637 20637 F DEBUG   :     x16 00000076831db068  x17 00000076831c5380  x18 000000769201c000  x19 000000000000507d
04-09 13:44:47.694 20637 20637 F DEBUG   :     x20 000000000000507d  x21 00000000ffffffff  x22 0000007fde37fe10  x23 0000007fde37fb70
04-09 13:44:47.694 20637 20637 F DEBUG   :     x24 0000007690fcca40  x25 b4000075beda9de0  x26 0000000000000000  x27 0000007fde383b30
04-09 13:44:47.694 20637 20637 F DEBUG   :     x28 0000007fde383900  x29 0000007fde37f7e0
04-09 13:44:47.694 20637 20637 F DEBUG   :     lr  000000768315a8d8  sp  0000007fde37f760  pc  000000768315a8fc  pst 0000000000001000
04-09 13:44:47.694 20637 20637 F DEBUG   : 2 total frames
04-09 13:44:47.694 20637 20637 F DEBUG   : backtrace:
04-09 13:44:47.694 20637 20637 F DEBUG   :       #00 pc 000000000005e8fc  /apex/com.android.runtime/lib64/bionic/libc.so (abort+156) (BuildId: 3cad38c74be79004f5b2927be886e077)
04-09 13:44:47.694 20637 20637 F DEBUG   :       #01 pc 00000000004e7724  /data/app/~~YNTHhl-nErW78vUBxMqLuw==/com.companyname.sigabrt-basOk17IE5IDqlifChSlqA==/split_config.arm64_v8a.apk (offset 0x7f3000)

sigabrt.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions