The students who have just started programming with GDB in Linux may find that each time you use GDB to set a breakpoint debug program, but the next time you open it, all breakpoints are gone, it's inconvenient. The methods for saving and reading breakpoints are described below.
1. Save Breakpoints
First Use info B to view the currently set breakpoints, use the Save Breakpoint command to save to the specified file, where I use the and process name plus the BP suffix, you can take the name you like.
I'm using save breakpoint FIG8.3.BP.
2. Read breakpoints
Note that, while GDB has already loaded the process, it is not able to read the breakpoint file, you must specify the breakpoint file in the GDB load File command, specifically using the-x parameter. For example, I need to debug fig8.3 this file, specifying the breakpoint file fig8.3.bp just saved.
I'm using GdB fig8.3-x fig8.3.bp.
Note that the files you are debugging need to be compiled with the-G parameter to be able to debug oh.
OK, other debugging methods I will be on the way.