NotePublic/Software/Applications/GDB/GDBServer_的使用.md

23 lines
608 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GDBServer 的使用
GDBServer 用于与 GDB 配合工作,以实现远程调试。在 Host 上开发的程序,运行于 Target/Remote 端,因此 GDBServer 也运行于 Target/Remote 端进行监听GDB 运行于 Host 端实现远程调试。
## Target/Remote 端
gdbserver 的使用非常简单,只要在某个端口上开启监听就可以:
```bash
gdbserver [listen ip]:<listen port> <program> [program args]
```
## Host 端
Host 端需要先连接 Target/Remote
```bash
gdb
(gdb) target remote [remote ip]:<remote port>
```
之后就可以像在本地调试那样使用 GDB 了。