gdbserver使用

目录

官网解析:

gdbserver主要有三种用法:

一、调试指定的应用程序(可以通过tcp,也可以通过串口)

二、调试已经在运行的程序

三、调试多个程序,一般用的少,在此暂时不写

应用:wiki上的例子


官网解析:

gdbserver-manicon-default.png?t=L892https://man7.org/linux/man-pages/man1/gdbserver.1.html#:~:text=gdbserver%20is%20a%20program%20that,put%20onto%20the%20target%20system.gdbserver-wikiicon-default.png?t=L892https://en.wikipedia.org/wiki/Gdbserver

       First, you need to have a copy of the program you want to debug
       put onto the target system.  The program can be stripped to save
       space if needed, as gdbserver doesn't care about symbols.  All
       symbol handling is taken care of by the GDB running on the host
       system.

这段话是说:

远端gdbserver调试的程序可以是strip过的,gdnserver并不在乎(符号)symbols,

所有的符号处理只与host(主机)上的程序有关

gdbserver主要有三种用法:

一、调试指定的应用程序(可以通过tcp,也可以通过串口)

  The general syntax is:
  target> gdbserver <comm> <program> [<args> ...]
gdbserver host:2345 emacs foo.txt

二、调试已经在运行的程序

This is accomplished via the --attach argument.  The syntax is:
target> gdbserver --attach <comm> <pid>

三、调试多个程序,一般用的少,在此暂时不写

应用:wiki上的例子

remote@~$ gdbserver :2159 hello_world
Process hello_world created; pid = 2509
Listening on port 2159
local@~$ gdb -q hello_world
Reading symbols from /home/user/hello_world...done.
(gdb) target remote 192.168.0.11:2159
Remote debugging using 192.168.0.11:2159
0x002f3850 in ?? () from /lib/ld-linux.so.2
(gdb) continue
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x08048414 in main () at hello_world.c:10
10	        printf("x[%d] = %g\n", i, x[i]);
(gdb)

补充

1、gdbserver的使用,--attach的使用

2、set follow-fork-mode child  的使用,但是暂时不知道为什么一直调试的parent进程

3、编译某个平台host的gdb

4、了解gdb的编译的--target,--host的编译,了解各个编译工具链的的gdb是如何编译的

5、记录gdb在其他设备直接修改源码链接,可以直接找到源码的问题

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值