Penguin38 / OpenCoreSDK

android user-space coredump feature
Apache License 2.0
23 stars 7 forks source link

如何解析core文件 #1

Closed ltpanda closed 11 months ago

ltpanda commented 11 months ago

尝试用lldb打开core文件失败,请问生成的core文件怎么使用

Penguin38 commented 11 months ago

有 Opencore 这个关键字的日志吗。 例如: 11-16 17:13:55.237 13944 19980 I Opencore-arm64: Wait (20330) coredump 11-16 17:13:55.447 20330 20330 I Opencore-arm64: Coredump /storage/emulated/0/Android/data/penguin.opencore.coretester/files/core.13944 ... 11-16 17:13:55.454 20330 20330 I Opencore-arm64: WriteCoreLoadSegment Mode(3) 11-16 17:13:56.424 20330 20330 I Opencore-arm64: [0x5ffff37000] /mali csf db (deleted) Not in self. 11-16 17:13:56.424 20330 20330 I Opencore-arm64: [0x5ffff4a000] /mali csf db (deleted) Not in self. 11-16 17:13:56.425 20330 20330 I Opencore-arm64: [0x5ffff5d000] /mali csf db (deleted) Not in self. 11-16 17:13:56.426 20330 20330 I Opencore-arm64: [0x5ffff70000] /mali csf db (deleted) Not in self. 11-16 17:13:56.427 20330 20330 I Opencore-arm64: [0x5ffff83000] /mali csf db (deleted) Not in self. 11-16 17:13:56.700 20330 20330 I Opencore-arm64: [0x737c09d000] /memfd:jit-cache (deleted) Not in self. 11-16 17:14:01.196 20330 20330 I Opencore-arm64: [0x743168b000] /mali csf user_reg (deleted) Not in self. 11-16 17:14:01.240 20330 20330 I Opencore-arm64: Coredump Done.

Penguin38 commented 11 months ago

lldb 上使用,如下 目录下有以下文件 app_process core.13944 libc.so libopencore-jni.so libopencore.so

(lldb) target create -c core.13944 app_process (lldb) platform select --sysroot . remote-linux

(lldb) thread list Process 0 stopped thread #1: tid = 13944, 0x000000741db312fc libc.so syscall + 28, stop reason = signal SIGSTOP thread #2: tid = 19953, 0x000000741db8e6e8 libc.so rt_sigtimedwait + 8, stop reason = signal 0 thread #3: tid = 19955, 0x000000741db8d9e4 libc.so read + 4, stop reason = signal 0 thread #4: tid = 19956, 0x000000741db8edc4 libc.so ppoll + 4, stop reason = signal 0 thread #5: tid = 19957, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #6: tid = 19958, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #7: tid = 19959, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #8: tid = 19960, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #9: tid = 19961, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #10: tid = 19962, 0x000000741db8dd08 libc.so ioctl + 8, stop reason = signal 0 thread #11: tid = 19964, 0x000000741db8dd08 libc.so ioctl + 8, stop reason = signal 0 thread #12: tid = 19967, 0x000000741db8dd08 libc.so ioctl + 8, stop reason = signal 0 thread #13: tid = 19970, 0x000000741db8ecc8 libc.so__epoll_pwait + 8, stop reason = signal 0 thread #14: tid = 19974, 0x000000741db312fc libc.so`syscall + 28, stop reason = signal 0 thread #15: tid = 19980, 0x000000741db8eec4 libc.so wait4 + 4, stop reason = signal 0 thread #16: tid = 19984, 0x000000742b2ea2d8, stop reason = signal 0 thread #17: tid = 19993, 0x000000741db8ecc8 libc.so epoll_pwait + 8, stop reason = signal 0 thread #18: tid = 19994, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #19: tid = 19995, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #20: tid = 19998, 0x000000741db8ecc8 libc.so epoll_pwait + 8, stop reason = signal 0 thread #21: tid = 20008, 0x000000741db8edc4 libc.so ppoll + 4, stop reason = signal 0 thread #22: tid = 20010, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #23: tid = 20011, 0x000000741db8ecc8 libc.so epoll_pwait + 8, stop reason = signal 0 thread #24: tid = 20012, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #25: tid = 20014, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #26: tid = 20015, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #27: tid = 20016, 0x000000741db8dd08 libc.so ioctl + 8, stop reason = signal 0 thread #28: tid = 20017, 0x000000741db312fc libc.so syscall + 28, stop reason = signal 0 thread #29: tid = 20317, 0x000000741db8ecc8 libc.so epoll_pwait + 8, stop reason = signal 0 thread #30: tid = 20318, 0x000000741db8ecc8 libc.so __epoll_pwait + 8, stop reason = signal 0 thread #31: tid = 20324, 0x000000741db8dd08 libc.so ioctl + 8, stop reason = signal 0

(lldb) thread select 15 thread #15, stop reason = signal 0 frame #0: 0x000000741db8eec4 libc.so wait4 + 4 libc.so wait4: -> 0x741db8eec4 <+4>: svc #0 0x741db8eec8 <+8>: cmn x0, #0x1, lsl #12 ; =0x1000 0x741db8eecc <+12>: cneg x0, x0, hi 0x741db8eed0 <+16>: b.hi 0x741db8d4d0 ; __set_errno_internal

(lldb) bt thread #15, stop reason = signal 0 frame #0: 0x000000741db8eec4 libc.so wait4 + 4 frame #1: 0x0000007376310f80 libopencore.so OpencoreImpl::DoCoreDump() + 100 frame #2: 0x000000737630e9d8 libopencore.so Opencore::dump(bool) + 72 frame #3: 0x0000007376360de8 libopencore-jni.so Java_penguin_opencore_sdk_Coredump_native_1doCoredump + 16 frame #4: 0x0000007394556434 libart.so art_quick_generic_jni_trampoline + 148 frame #5: 0x000000739453f9a8 libart.so art_quick_invoke_stub + 616 frame #6: 0x0000007394582b10 libart.so art::ArtMethod::Invoke(art::Thread, unsigned int, unsigned int, art::JValue, char const) + 176 frame #7: 0x000000739471f964 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2164 frame #8: 0x000000739455f518 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 13384 frame #9: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #10: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.uniq.112435418011751916792819755956732575238) + 452 frame #11: 0x000000739471eb48 libart.so art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame, art::JValue) + 104 frame #12: 0x000000739471f940 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2128 frame #13: 0x000000739455f784 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 14004 frame #14: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #15: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.uniq.112435418011751916792819755956732575238) + 452 frame #16: 0x000000739471eb48 libart.so art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame, art::JValue) + 104 frame #17: 0x000000739471f940 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2128 frame #18: 0x000000739455f518 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 13384 frame #19: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #20: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238) + 452 frame #21: 0x000000739471eb48 libart.so art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame, art::JValue) + 104 frame #22: 0x000000739471f940 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2128 frame #23: 0x000000739455f518 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 13384 frame #24: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #25: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.uniq.112435418011751916792819755956732575238) + 452 frame #26: 0x000000739471eb48 libart.so art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame, art::JValue) + 104 frame #27: 0x000000739471f940 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2128 frame #28: 0x000000739455f784 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 14004 frame #29: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #30: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.uniq.112435418011751916792819755956732575238) + 452 frame #31: 0x000000739471eb48 libart.so art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame, art::JValue) + 104 frame #32: 0x000000739471f940 libart.so bool art::interpreter::DoCall(art::ArtMethod, art::Thread, art::ShadowFrame&, art::Instruction const, unsigned short, bool, art::JValue) + 2128 frame #33: 0x000000739455f784 libart.so void art::interpreter::ExecuteSwitchImplCpp(art::interpreter::SwitchImplContext) + 14004 frame #34: 0x0000007394558bdc libart.so ExecuteSwitchImplAsm + 12 frame #35: 0x0000007394717f54 libart.so art::interpreter::Execute(art::Thread, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.__uniq.112435418011751916792819755956732575238) + 452 frame #36: 0x0000007394a94a3c libart.so artQuickToInterpreterBridge + 668 frame #37: 0x000000739455656c libart.so art_quick_to_interpreter_bridge + 92 frame #38: 0x000000739453f9a8 libart.so art_quick_invoke_stub + 616 frame #39: 0x0000007394582b10 libart.so art::ArtMethod::Invoke(art::Thread, unsigned int, unsigned int, art::JValue, char const) + 176 frame #40: 0x00000073949d2e4c libart.so art::Thread::CreateCallback(void) + 1420 frame #41: 0x000000741dba2d60 libc.so __pthread_start(void*) + 208 frame #42: 0x000000741db36bc4 libc.so __start_thread + 68

ltpanda commented 11 months ago

请问app_process从哪里获取

Penguin38 commented 11 months ago

在手机里 /system/bin/ 目录下

ltpanda commented 11 months ago

我这边加载成功了,但是显示frame信息感觉是不全的,只有地址没有堆栈信息

(lldb) bt
* thread #1, stop reason = signal SIGSTOP
  * frame #0: 0x0000006fee8da48c
    frame #1: 0x0000006cf98212c4
    frame #2: 0x0000006cf9822d30
    frame #3: 0x000000006f6a6400
Penguin38 commented 11 months ago

获得解析该core所依赖的so文件。 (lldb) image list

frame 不全与依赖的so文件有关。

ltpanda commented 11 months ago

我把libart.so拷贝出来后,堆栈丰富了很多,非常感谢