clear command
Deletes a breakpoint at a specified location.
Syntax
clear [Location]
Parameters
- Location
- Specifies the location of a breakpoint that should be removed (see the break command for details). If not specified, GDB will try to remove a breakpoint in the current location.
Attention
Do not confuse this command with the delete comand that accepts a breakpoint number rather than location.
Remarks
Use the enable command to enable breakpoints, disable command to disable them, or the info breakpoints command to display information about breakpoints.
Examples
In this command we will set a breakpoint inside a loop and then disable it once it hits.
Breakpoint 1 at 0x80483f7: file test.cpp, line 6.
(gdb) run
Starting program: /home/testuser/test
Breakpoint 1, main () at test.cpp:6
6 printf("%di);
(gdb) clear 6
Deleted breakpoint 1
(gdb) continue
Continuing.
0
1
2
3
4
[Inferior 1 (process 26660) exited normally]
Common errors
If you accidentially use the delete command instead of the clear commmand, the argument will be interpreted as the breakpoint number and not the line number. This may result in deleting a different breakpoint than you would expect or fail with an error message:
Breakpoint 1 at 0x80483f7: file test.cpp, line 6.
(gdb) delete 6
No breakpoint number 6.
(gdb) clear 6
Deleted breakpoint 1
Compatibility with VisualGDB
Normally you do not need to run the clear command under VisualGDB. Please use the Breakpoints window in Visual Studio to view and manage your breakpoints.