This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Debugging C++ Function Calls
- From: Lawrence Crowl <crowl at googlers dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Tue, 26 Mar 2013 13:35:04 -0700
- Subject: Re: Debugging C++ Function Calls
- References: <CAGqM8fYQTA-t7SLrPcw2UQOG8Yv1GLmhngnDszZ3yfV5QDQmug at mail dot gmail dot com> <87620fs5nj dot fsf at fleche dot redhat dot com> <CAGqM8fb-Cvd-yQ9haOcA7xFpdxioT5UqR6jtwZPUG=So7rXQbg at mail dot gmail dot com> <87y5dbqqns dot fsf at fleche dot redhat dot com>
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