GDB 与GDBserver交叉调试的总结

terminal端运行可执行程序 APP,

然后在利用 PS 命令查看一下当前 APP的进程号, 然后在terminal端输入:

gdbserver :port  --attach pid


然后如果命令执行成功后会显示:

root@Phoenix /appfs/apps/Test#gdbserver :4321 --attach 1113
Attached; pid = 1113
Listening on port 4321

然后回到PC端开启ARM-LINUX-GDB:

# /home/arm-linux-gdb test
GNU gdb (GDB) 7.1
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-linux".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /work/Work_Sorce_Code/NEW_Land/Newland_EverlinkChip/test/test...done.
(gdb) target remote 192.168.8.106:4321
Remote debugging using 192.168.8.106:4321


(gdb) set solib-search-path ../libs/
这样GDB就可以去这个目录下去加载动态库 .SO 的符号表,根据加载的符号表去当前的GDB的代码搜索路径下去查找与之匹配的代码,然后显示代码。如果找不到与之匹配的代码
可以用命令添加代码路径 source 或者 dir 命令添加要搜索的代码路径。



声明:如果本文章中说的有不对的地方,希望各位看官同行给与指正,共同学习,谢谢!!!!!!



猜你喜欢

转载自blog.csdn.net/rebirthme/article/details/78874229
今日推荐