This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Debugging C++ Function Calls


On 3/25/13, Tom Tromey <tromey@redhat.com> wrote:
> I think the intro text of this message provides the best summary
> of the approach:
>
> http://sourceware.org/ml/gdb-patches/2010-07/msg00284.html

Are the symbol searches specific to the scope context, or does it
search all globally defined symbols?

If you recreate the name lookup as the compiler did, I think the
approach will be workable.  Otherwise, there is a potential for
doing overload resoulution and getting a different result.  I don't
think the template names directly make much difference here.

There is a weakness in the patch, int that the following is legal.

template<typename T> T func(T arg) { return arg + 0; }
template<> int func(int arg) { return arg + 1; }
int func(int arg) { return arg + 2; }
int main() { return func(0); }

The language prefers to call a non-template function over a template
instance with the same paramter types.

So, in your new search, you could have two functions with the same
name and same parameter types.  You will need to keep a bit on the
template-derived version so that you can break the tie.

-- 
Lawrence Crowl


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]