Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 7497

Summary: GDB can't resolve calls to member functions oftemplate classes
Product: [Retired] Red Hat Linux Reporter: mcmillan
Component: gdbAssignee: Nalin Dahyabhai <nalin>
Status: CLOSED RAWHIDE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.1CC: tim
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-05-30 18:26:23 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Description mcmillan 1999-12-01 22:37:14 UTC
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 22:09:59 UTC
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 08:54:59 UTC
Seems to be fixed in Debian distribution; see Bug#43955 Debian Bugs database.

Comment 3 Cristian Gafton 2000-02-17 22:44:59 UTC
jim, can you please check that bug out?

Comment 4 Jim Kingdon 2000-02-18 01:35:59 UTC
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 14:10:59 UTC
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 13:20:59 UTC
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 18:26:59 UTC
GDB 5.0 is now in Rawhide, and fixes this problem.