First you need to install gdb, the following is divided into two platforms: Windows and Linux / Ubuntu:
1. Install gdb under Windows:
Please refer to: Install and Compile GDB Debugging Tools under Windows
2. Install gdb under Linux / Ubuntu:
2.1 Method 1:apt-get
Open the terminal and enter the following commands in the terminal:
apt-get update
apt-get install gdb
During installation, you need to select y to confirm the installation of gdb.
2.1 Method 2: Install gdb through the installation package
Please refer to: How to install and view gdb under Linux