Bug 7497 - GDB can't resolve calls to member functions oftemplate classes
GDB can't resolve calls to member functions oftemplate classes
Status: CLOSED RAWHIDE
Product: Red Hat Linux
Classification: Retired
Component: gdb (Show other bugs)
6.1
All Linux
medium Severity medium
: ---
: ---
Assigned To: Nalin Dahyabhai
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 1999-12-01 17:37 EST by mcmillan
Modified: 2008-05-01 11:37 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2000-05-30 14:26:23 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description mcmillan 1999-12-01 17:37:14 EST
Note: I've also sent this bug the bug-gdb mailing list.
Reverting to the version of GDB in RH5.2 solves the problem.

GDB can't seem to resolve calls to member functions of
template classes in a "print" command. This used to work,
but now gives the error message:

Cannot resolve method ... to any overloaded instance

GDB version: 4.18
Compiler: egcs 1.1.2 or gcc 2.95.1

Example:

#include <stream.h>

template<class foo>
class bar {
public:
  foo i;
  void show() {
    cout << i;
  }
};

main(){
  bar<int> q;
  q.show();    /* included just to instantiate member */
}

Compile thus:

g++ -g gdbbug.cc -o gdbbug

Debug thus:

gdb gdbbug
b main
r
p q.show()

Gdb response:

Cannot resolve method bar<int>::show to any overloaded instance

This was run under Red Hat 6.1. At the very least, the error
message makes no sense, since a function with no arguments cannot
be overloaded.
Comment 1 Jim Kingdon 1999-12-07 17:09:59 EST
I was able to reproduce this problem with gdb-4.18-6 which is what is
in Rawhide.
Comment 2 Tim Ruhl 1999-12-17 03:54:59 EST
Seems to be fixed in Debian distribution; see Bug#43955 Debian Bugs database.
Comment 3 Cristian Gafton 2000-02-17 17:44:59 EST
jim, can you please check that bug out?
Comment 4 Jim Kingdon 2000-02-17 20:35:59 EST
See:
  http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00330.html
  http://sourceware.cygnus.com/ml/gdb/2000-q1/msg00333.html
Note that Debian bug #43955 does not contain a fix as far as I could
see.
Comment 5 Jim Kingdon 2000-03-12 09:10:59 EST
I believe this is fixed by Dan Berlin's checkin of 2000-03-10 to valops.c
(I know Dan Berlin has a fix and I think that is the one).  So try GDB
from CVS (http://sourceware.cygnus.com/gdb/) or wait for us to get
around to putting that GDB into Rawhide (I'd recommend the former but
I may be biased :-)).
Comment 6 Andrew Lincoln Burrow 2000-03-17 08:20:59 EST
I have been able to cure this problem by setting
"over-load-resolution" off.
The bug may be as little as a mixed up condition test.
For example, under gud on an i386, RedHat 6.1 system:

(gdb) set overload-resolution off
(gdb) p _cons.const_types()
$1 = (KrInheritanceHierarchy *) 0x8127a88
(gdb) set overload-resolution on
(gdb) p _cons.const_types()
Cannot resolve method KrManualCons::const_types to any overloaded instance
Comment 7 Trond Eivind Glomsrxd 2000-05-30 14:26:59 EDT
GDB 5.0 is now in Rawhide, and fixes this problem.

Note You need to log in before you can comment on or make changes to this bug.