c++/1927: gdb 6.3 can't resolve overloaded functions

rrh@cray.com rrh@cray.com
Mon Apr 25 16:38:00 GMT 2005

>Number:         1927
>Category:       c++
>Synopsis:       gdb 6.3 can't resolve overloaded functions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Apr 25 16:38:01 UTC 2005
>Originator:     Robert Henry
>Release:        GNU gdb
Linux steel10 2.4.20-64GB-SMP #1 SMP Mon Mar 17 17:56:03 UTC 2003 i686 unknown unknown GNU/Linux
debuggee version (victim program): gcc version 3.3.5
This GDB was configured as "i686-pc-linux-gnu".

gdb version 6 gets confused when breakpoints are put onto
overloaded c++ functions.  The breakpoint query interaction says that the breakpoint is ?HERE; the pc gets mapped to pc 0.  Attempting to list an overloaded c++ function results in a gdb segfault.

All versions of gdb 6 I had available on suse linux have this problem.  gdb 5.3 doesn't seem to have this problem.  gdb 6 on solaris also has this problem.

This problem happens when I compile the debuggee/victim program with with either "gcc -g" or "gcc -ggdb"
Compile the attached file.  Run under gdb.  Put a breakpoint on:
  b InstSelection::InstSelection
There are 2 functions with this overload, which is expected (one exlicitly given, the other default constructor).
[0] cancel
[1] all
Note: breakpoint -1 (disabled) also set at pc 0x0.
Breakpoint 1 at 0x0
Note: breakpoints -1 (disabled) and 1 also set at pc 0x0.
Breakpoint 2 at 0x0

then, do
  list InstSelection::InstSelection
observe same output, and then selection [1], and
get a segfault.

Here's the debugged program (victim):
#include <stdio.h>
class InstSelection {
  InstSelection(double d) {
  virtual ~InstSelection(void);
  void dump(void);


void InstSelection::dump(void)
  printf("InstSelection::dump here\n");

int main(void)
  InstSelection *is = new InstSelection(17.0);
  delete is; is = 0;
  return 0;


Content-Type: application/octet-stream; name="gdb.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdb.cc"


More information about the Gdb-prs mailing list