This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
c++/1927: gdb 6.3 can't resolve overloaded functions
- From: rrh at cray dot com
- To: gdb-gnats at sources dot redhat dot com
- Date: 25 Apr 2005 16:30:31 -0000
- Subject: c++/1927: gdb 6.3 can't resolve overloaded functions
- Reply-to: rrh at cray dot com
>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
>Closed-Date:
>Last-Modified:
>Originator: Robert Henry
>Release: GNU gdb 6.3.50.20050423
>Organization:
>Environment:
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".
>Description:
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"
>How-To-Repeat:
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).
Observe:
[0] cancel
[1] all
?HERE
?HERE
1
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 {
public:
InstSelection(double d) {
}
public:
virtual ~InstSelection(void);
void dump(void);
};
InstSelection::~InstSelection(void)
{
}
void InstSelection::dump(void)
{
printf("InstSelection::dump here\n");
}
int main(void)
{
InstSelection *is = new InstSelection(17.0);
is->dump();
delete is; is = 0;
return 0;
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gdb.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gdb.cc"
I2luY2x1ZGUgPHN0ZGlvLmg+CmNsYXNzIEluc3RTZWxlY3Rpb24gewpwdWJsaWM6CiAgSW5zdFNl
bGVjdGlvbihkb3VibGUgZCkgewogIH0KcHVibGljOgogIHZpcnR1YWwgfkluc3RTZWxlY3Rpb24o
dm9pZCk7CiAgdm9pZCBkdW1wKHZvaWQpOwp9OwoKSW5zdFNlbGVjdGlvbjo6fkluc3RTZWxlY3Rp
b24odm9pZCkKewp9Cgp2b2lkIEluc3RTZWxlY3Rpb246OmR1bXAodm9pZCkKewogIHByaW50Zigi
SW5zdFNlbGVjdGlvbjo6ZHVtcCBoZXJlXG4iKTsKfQoKaW50IG1haW4odm9pZCkKewogIEluc3RT
ZWxlY3Rpb24gKmlzID0gbmV3IEluc3RTZWxlY3Rpb24oMTcuMCk7CiAgaXMtPmR1bXAoKTsKICBk
ZWxldGUgaXM7IGlzID0gMDsKICByZXR1cm4gMDsKfQo=