如何调试用 C 运行 开发的进程作为 Wi-Fi 接入点?
How to debug a process developed in C running as a Wi-Fi Access Point?
我有两个用 C 语言开发的进程。第一个是 运行 作为 Linux 机器中的 WiFi 接入点,第二个是 运行 作为另一台机器中的控制器 Linux 以太网络中的机器。后者可以向 AP 发送配置命令。
我的问题是当运行这两个进程以及当我从控制器向AP发送命令时,我该如何调试AP进程?
GNU 调试器(远程服务器)
GDB 是一种源代码级调试器,支持 C 和其他编程语言,能够在任何特定行中断程序、显示变量值并确定错误发生的位置。
要在所有当前支持的 Ubuntu(即 your operating system)版本中安装 GNU 调试器和 GNU 调试器(远程服务器),请打开终端并输入:
sudo apt install gdb gdbserver
用法
gdbserver is launched on the target system, with the arguments:
- Either a device name (to use a serial line) or a TCP hostname and portnumber, and
- The path and filename of the executable to be debugged
It then waits passively for the host gdb to communicate with it.
gdb is run on the host (controller), with the arguments:
- The path and filename of the executable (and any sources) on the host, and
- A device name (for a serial line) or the IP address and port number needed for connection to the target system.
来源:Wikipedia
我有两个用 C 语言开发的进程。第一个是 运行 作为 Linux 机器中的 WiFi 接入点,第二个是 运行 作为另一台机器中的控制器 Linux 以太网络中的机器。后者可以向 AP 发送配置命令。 我的问题是当运行这两个进程以及当我从控制器向AP发送命令时,我该如何调试AP进程?
GNU 调试器(远程服务器)
GDB 是一种源代码级调试器,支持 C 和其他编程语言,能够在任何特定行中断程序、显示变量值并确定错误发生的位置。
要在所有当前支持的 Ubuntu(即 your operating system)版本中安装 GNU 调试器和 GNU 调试器(远程服务器),请打开终端并输入:
sudo apt install gdb gdbserver
用法
gdbserver is launched on the target system, with the arguments:
- Either a device name (to use a serial line) or a TCP hostname and portnumber, and
- The path and filename of the executable to be debugged
It then waits passively for the host gdb to communicate with it.gdb is run on the host (controller), with the arguments:
- The path and filename of the executable (and any sources) on the host, and
- A device name (for a serial line) or the IP address and port number needed for connection to the target system.
来源:Wikipedia