Supported on windows
Supported on linux
Supported on embedded
Supported on android

set multiple-symbols command

Controls how GDB handles multiple breakpoints

Syntax

set multiple-symbols all
set multiple-symbols ask
set multiple-symbols cancel
show multiple-symbols

Modes

all
When an expression specified to the break command resolves to more than one code location, GDB will create breakpoints for all resolved locations.
ask
When an expression specified to the break command resolves to more than one code location, GDB will display a list of resolved locations and allow selecting the ones to set breakpoints in.
cancel
When an expression specified to the break command resolves to more than one code location, GDB will cancel breakpoint creation.

Default mode

The default value for the multiple-symbols setting is 'all'.

Examples

We will demonstrate the set multiple-symbols command using a basic C++ program containing 2 overloads of the function test. Setting a breakpoint on test would thus resolve to both functions:

#include <stdio.h>

void test(int)
{
  printf("test(int) called\n");
}

void test(intint)
{
  printf("test(int,int) called\n");
}

int main()
{
  test(1);
  test(1, 2);
  return 0;
}

Below is the result of running the break command on test function using different modes of multiple-symbols:

(gdb) show multiple-symbols
How the debugger handles ambiguities in expressions is "all".
(gdb) break test
Breakpoint 1 at 0x80483da: test. (2 locations)
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y <MULTIPLE>
1.1 y 0x080483da in test(int) at test.cpp:5
1.2 y 0x080483ee in test(int, int) at test.cpp:10
(gdb) delete
Delete all breakpoints? (y or n) y
(gdb) set multiple-symbols ask
(gdb) break test
[0] cancel
[1] all
[2] test.cpp:test(int)
[3] test.cpp:test(int, int)
> 2 3
Breakpoint 2 at 0x80483da: file test.cpp, line 5.
Breakpoint 3 at 0x80483ee: file test.cpp, line 10.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) info breakpoints
Num Type Disp Enb Address What
2 breakpoint keep y 0x080483da in test(int) at test.cpp:5
3 breakpoint keep y 0x080483ee in test(int, int) at test.cpp:10
(gdb) delete
Delete all breakpoints? (y or n) y
(gdb) set multiple-symbols cancel
(gdb) break test
canceled because the command is ambiguous
See set/show multiple-symbol.
(gdb) break test(int)
Breakpoint 4 at 0x80483da: file test.cpp, line 5.

Compatibility with VisualGDB

Do not use the set multiple-symbols command with VisualGDB. Use the Visual Studio breakpoint GUI instead.

See also