With: struct base { int overload (void) const { return 0; } // base::overload(void) const int overload (int) const { return 0; } // base::overload(int) const }; int main (int argc, char* argv[]) { base a; (void) a.overload (); (void) a.overload (1); return 0; } Listing the (void) variant without the `const' fails: (gdb) list 'base::overload()' the class `base' does not have any method instance named overload() With `const', it succeeds: (gdb) list 'base::overload() const' 1 struct base 2 { 3 int overload (void) const { return 0; } // base::overload(void) const 4 int overload (int) const { return 0; } // base::overload(int) const 5 }; Since there's no ambiguity, gdb could pick the const variant without the explicit `const'. This affects "break" and "print" similarly. Interestingly, if you drop all but one of the overloads (hence, no overloads) gdb ignores all the prototype arguments you specify, and always finds something: (gdb) list 'base::overload' 1 struct base ... (gdb) list 'base::overload()' 1 struct base ... (gdb) list 'base::overload(asdf1234)' 1 struct base ... (gdb) list 'base::overload(?????)' 1 struct base ...
I was pointed out that "print" is already lax if not quoted: (gdb) p base::overload(void) $3 = {int (const base * const)} 0x4005c8 <base::overload() const> (gdb) p 'base::overload(void)' No symbol "base::overload(void)" in current context. (gdb) p base::overload(int) $5 = {int (const base * const, int)} 0x4005d8 <base::overload(int) const> (gdb) p 'base::overload(int)' No symbol "base::overload(int)" in current context. (gdb) While list and break aren't. linespecs vs expressions.