我正在尝试调试一个虚幻引擎4本机应用程序(我制作的游戏).有时我看到游戏崩溃时会产生"墓碑".但不总是 ...
有没有办法强制生成墓碑?为什么每次我的游戏崩溃都不会产生它?
提前致谢
当程序在Linux下崩溃时,转储是由debuggerd创建的.发生这种情况时,内核会向死亡程序发送信号.这个信号被仿生C库安装在每个原生Android应用程序中的特殊信号处理程序捕获(这就是为什么不为基于Java的Android应用程序生成逻辑删除的原因).信号处理程序联系debuggerd(通过命名管道),然后使用ptrace连接回死程序以读取寄存器和内存以生成逻辑删除和日志条目.
./bionic/linker/debugger.cppdebuggerd_signal_handler()为几个信号安装信号处理程序,在调用时将尝试使用管道与debuggerd通信以创建逻辑删除文件.我想如果管道通信失败或ptrace回到崩溃过程失败,那么将不会生成逻辑删除.但是仍然应该记录那些失败(在墓碑文件或logcat中,或者两者兼而有之 - 我不确定).可能存在导致逻辑删除文件未生成的其他问题.
有关如何通过仿生链接器设置信号处理,请参阅以下内容(此处提及的所有函数名称和文件均来自Android 4.4,但在其他版本中应该类似):
__linker_init_post_relocation() 在 ./bionic/linker/linker.cppdebuggerd_init() 在 ./bionic/linker/debugger.cppdebuggerd_signal_handler() 在 ./bionic/linker/debugger.cpp有关如何debuggerd响应处理崩溃进程的请求,请参阅以下内容:
do_server()in ./system/core/debuggerd/debuggerd.c //打开管道以接收请求handle_request()in ./system/core/debuggerd/debuggerd.c //处理处理崩溃进程的请求请记住,在大多数情况下,墓碑可以在已取得 root 权限的设备上生成。
首先确定您的应用程序的 PID:
adb shell ps | grep <your app>
Run Code Online (Sandbox Code Playgroud)
样本:
adb shell ps | grep br
root 257 2 0 0 rescuer_th 0000000000 S k_gbridge
u0_a7 9404 537 2052020 45460 SyS_epoll_ 7f921a99d0 S com.android.cellbroadcastreceiver
Run Code Online (Sandbox Code Playgroud)
第二次发送 SIGSEGV 信号到您的 PID(在我们的示例中为 9404):
adb shell kill -11 <YOUR PID>
Run Code Online (Sandbox Code Playgroud)
例子:
adb shell kill -11 9404
Run Code Online (Sandbox Code Playgroud)
信号列表:
SIGHUP 1 Exit Hang up
SIGINT 2 Exit Interrupt
SIGQUIT 3 Core Quit
SIGILL 4 Core Illegal Instruction
SIGTRAP 5 Core Trace/Breakpoint Trap
SIGABRT 6 Core Abort
SIGEMT 7 Core Emulation Trap
SIGFPE 8 Core Arithmetic Exception
SIGKILL 9 Exit Killed
SIGBUS 10 Core Bus Error
SIGSEGV 11 Core Segmentation Fault
SIGSYS 12 Core Bad System Call
SIGPIPE 13 Exit Broken Pipe
Run Code Online (Sandbox Code Playgroud)
第三次检查生成的文件:
adb shell ls -la /data/tombstones/
Run Code Online (Sandbox Code Playgroud)
例子:
adb shell cat /data/tombstones/tombstone_00
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
LineageOS Version: '14.1-20170512-NIGHTLY-zl1'
Build fingerprint: 'LeEco/le_zl1/LePro3:6.0.1/MMB29M/362280:user/release-keys'
Revision: '0'
ABI: 'arm64'
pid: 9404, tid: 9404, name: oadcastreceiver >>> com.android.cellbroadcastreceiver <<<
signal 11 (SIGSEGV), code 0 (SI_USER), fault addr 0x3aab
x0 fffffffffffffffc x1 0000007fc3ad89a8 x2 0000000000000010 x3 00000000ffffffff
x4 0000000000000000 x5 0000000000000008 x6 0000007f92808000 x7 0000000000000000
x8 0000000000000016 x9 7fffffffffffffff x10 0000000000000000 x11 0000007fc3ad8a98
x12 0000000000000000 x13 ffffffffa26d50eb x14 00010bc3b9000000 x15 003b9aca00000000
x16 0000007f92200470 x17 0000007f9215c374 x18 0000000000000011 x19 3a3580d85807b977
x20 0000007f8e8a3188 x21 00000000ffffffff x22 00000000ffffffff x23 0000007f8e8a30e0
x24 0000000000000028 x25 0000000000000000 x26 00000000716d0b90 x27 000000007a258060
x28 0000007f834e1680 x29 0000007fc3ad8950 x30 0000007f9215c3b8
sp 0000007fc3ad8930 pc 0000007f921a99d0 pstate 0000000060000000
Run Code Online (Sandbox Code Playgroud)
注意:如果您有关于命令“adb shell ls -la /data/tombstones/”权限的消息,您需要运行以下命令:
adb root
adb remount
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2810 次 |
| 最近记录: |