墨刀做网站上下滑动的交互,余姚网站推广,百度关键词优化多少钱一年,代理服务器地址怎么找Qnx coredump解析
coredump文件
Qnx运行的程序崩溃时#xff0c;会生成coredump文件。 默认情况下这些文件默认会保存在/var/log/*.core 文件中。
解析coredump文件#xff0c;可以帮忙加快分析程序崩溃的原因#xff0c;比如了解崩溃的堆栈。 通常可以使用gdb和coreinfo…Qnx coredump解析
coredump文件
Qnx运行的程序崩溃时会生成coredump文件。 默认情况下这些文件默认会保存在/var/log/*.core 文件中。
解析coredump文件可以帮忙加快分析程序崩溃的原因比如了解崩溃的堆栈。 通常可以使用gdb和coreinfo帮助分析coredump文件。
coreinfo
coreinfo是QNX提供的一个bin文件这个bin用来显示CoreDump文件的信息
coreinfo [-ilmstv] file [file ...]选项 -i 显示进程信息 -l 显示QNT_LINK_MAP相关信息 -m 显示内存Map(Memeroy Map) -t 显示线程信息 -v 追加debug信息输出 如果不指定这些选项默认输出所有信息。 coreinfo官网链接 https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.utilities/topic/c/coreinfo.html
coreinfo默认集成在Qnx的Image中在Qnx系统终端执行即可。例如
coreinfo /var/log/test.core输出信息类似如下内容 包括cpu核信息、MACHINE、HOSTNAME、崩溃进程中线程状态等。这些信息对了解程序崩溃的状态有些帮忙但是对具体的问题解析还是需要利用gdb工具。 processorARM AArch64 num_cpus8cpu 1 cpu1091556528 name*** *** Gold speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 2 cpu1091556528 name*** *** Gold speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 3 cpu1091556528 name*** *** Gold speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 4 cpu1091556528 name*** *** Gold speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 5 cpu1091556544 name*** *** Gold Plus speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 6 cpu1091556544 name*** *** Gold Plus speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 7 cpu1091556544 name*** *** Gold Plus speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cpu 8 cpu1091556544 name*** *** Gold Plus speed***flags0xc0000c7a FPU MMU V6 V7 V7_MP NEON IDIV VFP_D32cyc/sec*** tod_adj*** nsec*** inc***boot0 epoch1970 intr27rate*** scale-16 load1920MACHINE****** HOSTNAMElocalhostpid2076765 parent1138777 child0 pgrp*** sid***flags0x49002000 umask02 base_addr0x397fca7000 init_stack0x10c1000870ruid0 euid0 suid0 rgid0 egid0 sgid0ign0000000000000000 queueff00000000000000 pending0000000000000000fds4 threads2 timers0 chans1canstub0 sigstub0couldnt read stack: No such process
argc: 6 argv: thread 1ip0x4cec9ce290 sp0x10c1000690 stkbase0x10c0f80000 stksize528384stateJOIN flags0 last_cpu1 timeout00000000pri10 realpri10 policyRRtls0x10c1000dc0thread 2 SIGNALLED-SIGABRT code0 from pid2076765 uid-1 value0(0x0)ip0x4cec9ce2a0 sp0x10c1042760 stkbase0x10c1002000 stksize266240stateSTOPPED flags4000000 last_cpu1 timeout00000000pri10 realpri10 policyRRtls0x10c10429d0Gdb
gdb是常用的debug工具关于gdb的概念可自行百度理解。这里说一下Qnx上如何使用gdb。 一般来说Qnx源码中会提供针对架构的gdb工具。这些个工具可以在Host上运行。
ARMv7ntoarmv7-gdbAArch64ntoaarch64-gdbx86 64-bitntox86_64-gdb
Qnx官网说明链接https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.neutrino.utilities/topic/g/gdb.html
例如 qnx程序跑在AArch64架构下崩溃产生了coredump文件test.core 使用gdb的解析步骤
首先把test.core 从qnx系统中导入到Host上比如Ubutun上在host的QNX的源码中找到ntoaarch64-gdb路径可能在 qnx源码/**/host/linux/x86_64/usr/bin 中在Host上设置好Qnx编译环境一般在编译qnx源码时都会有一个sh脚本设置)使用gdb 加载崩溃的bin(Host上编译出来的bin 以及 test.core
# 例子路径根据实际情况修改
**/**/host/linux/x86_64/usr/bin/ntoaarch64-gdb install/aarch64le/usr/bin/test install/test.core如果gdb找不到bin程序需要的so等可以通过 set solib-search-path (GDB的交互命令网上使用方式比较多设置so的查找路径在gdb中运行bt即可输出崩溃堆栈前提so等库时带符号的可以在编译时加入导出debug符合的参数选项
下面是test.core的一段输出示意因为某些原因部分内容用了**代替所以只是示例
#0 Test::start (this0x33f06840a8) at /*****/test.cpp:100:115
#1 0x00000049e17ed874 in Test::Test111 (this0x25a6f25990) at /*****/test.cpp:100
#2 0x00000049e17f06b4 in ****at /*****/qnx7/usr/include/c/v1/type_traits:4294
#3 std::__1::__thread_executestd::__1::unique_ptrstd::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct , void (Test::*)(), Test*, 2ul (__t...)at /*****/target/qnx7/usr/include/c/v1/thread:342
#4 std::__1::__thread_proxystd::__1::tuplestd::__1::unique_ptrstd::__1::__thread_struct, std::__1::default_deletestd::__1::__thread_struct , void (Test::*)(), Test* (__vp0x33f0685090) at /*****/qnx7/usr/include/c/v1/thread:352
#5 0x00000049e1970fa8 in pthread_attr_setdetachstate (attr0x105e0002, detachstate1869902687) at /***/build_aarch64/lib/c/1c/pthread_attr_setdetachstate.c:30实际上就是把coredump从Qnx系统中copy出来然后放到本地有Qnx开发环境以及相关二进制库的PC上。然后使用gdb加载即可。