QNX 调试
[toc]
前言
需要条件
- QNX 工具链
- 带调试信息的文件
以 aarch64 平台为例,其他平台需要换对应平台的 gdb 可执行文件
使用 GDB 启动
本机和 QNX 机器上都需要放相同的可执行文件
QNX 端
需要设置好进程需要的环境变量再启动 pdebug
export LD_LIBRARY_PATH=/path/to/lib
pdebug 8888 &
本机
启动 gdb
source /path/to/qnx/qnxsdp-env.sh
ntoaarch64-gdb
连接板端
target qnx ip:8888
# 输出类似下面
Remote debugging ip:8888
Remote target is little-endian
设置 gdb
set solib-search-path /local/path/to/lib
handle SIGILL nostop pass
加载调试符号
file /local/path/to/exe
设置远端工作环境
set nto-cwd /remote/path
设置远端可执行文件
set nto-executable /remote/path/to/exe
打断点
按实际情况处理
b main
启动
r arg1 arg2
附加到已启动进程
本机准备好远端相同的调试文件
启动 gdb 并连接板端
source /path/to/qnx/qnxsdp-env.sh
ntoaarch64-gdb
target qnx ip:8888
设置 gdb
set solib-search-path /local/path/to/lib
handle SIGILL nostop pass
加载调试符号
file /local/path/to/exe
查找需要调试的 pid
info pidlist exe-name
附加到进程
attach ${pid}
Core 文件
本机执行
source /path/to/qnx/qnxsdp-env.sh
ntoaarch64-gdb executable core_file
参考文档
https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.utilities/topic/g/gdb.html
由于个人水平有限,文中若有不合理或不正确的地方欢迎指出改正