当前位置:网站首页>Use gdb to debug multi-process programs, debug parent and child processes at the same time

Use gdb to debug multi-process programs, debug parent and child processes at the same time

2022-08-09 11:15:00 XV_

Reference:
[1] GDBdebugging multi-process programs
[2] Debugging programswith multiple processes

According to these two reference links, it is completely possible to use gdb to debug the parent process and the child process at the same time.

Next, I will explain the pits that may be encountered

  1. There is a bug in gdb8.1 version. After setting set detach-fork-on off, after executing fork, switch to subprocess, and encounter cannotAdd breakpoints and other issues
  2. gdb9.2 version also has bugs. When the process is switched, problems such as fork.c file missing will be encountered, but it does not affect, use the n command multiple timesJust skip it.

Therefore, at present, the author uses Ubuntu 20.10, gdb 10.2 to have no bugs, and can normally debug multiple processes at the same time.

Installation of gdb 10.2

原网站

版权声明
本文为[XV_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/221/202208091103198839.html