How to debug asynchronous software
Debugging is the process of finding and fixing errors in computer programs.
In this section, we will explore several techniques to debug multithreading and asynchronous software. You must have some previous knowledge of how to use debuggers, such as GDB (the GNU project debugger) or LLDB (the LLVM low-level debugger), and the terminology of the debugging process, such as breakpoints, watchers, backtraces, frames, and crash reports.
Both GDB and LLDB are excellent debuggers with most of their commands being the same and only a few ones that differ. LLDB might be preferred if the program is being debugged on macOS or for large code bases. On the other hand, GDB has an established legacy, being familiar to many developers, and supporting a broader range of architectures and platforms. In this section, we will use GDB 15.1 just because it is part of the GNU framework and was designed to work alongside the g++
compiler, but most commands shown later...