This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [patch] function eval cleanup
- From: Tom Tromey <tromey at redhat dot com>
- To: sami wagiaalla <swagiaal at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Wed, 14 Jul 2010 17:00:09 -0600
- Subject: Re: [patch] function eval cleanup
- References: <4C3B6428.8090906@redhat.com>
>>>>> "Sami" == sami wagiaalla <swagiaal@redhat.com> writes:
Sami> This code performs function evaluation before overload resolution
Sami> completes. Currently, for C++, this is a waste if overload
Sami> resolution results in a different function than the one which was
Sami> evaluated but it breaks a future patch of mine which introduces a
Sami> fake place holding variable needed for proper template function
Sami> evaluation.
You didn't mention how you tested this...
Sami> + /* If this is a C++ function wait until overload resolution. */
Sami> + if (overload_resolution
Sami> + && (exp->language_defn->la_language == language_cplus))
Sami> {
Sami> - for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
Sami> + (*pos) += 4; /* Skip the evaluation of the symbol. */
Why is it ok to add 4 here?
I think this assumes that the function in question is a symbol.
But is that always the case? What about something like calling via a
function pointer? Or some other more complicated subexpression?
If there is a failing case here, and it was not caught by the test
suite, please also add a regression test.
Some day we should refactor this whole case, it is really hard to
understand. And 'overload_resolution' -- another global affecting
things randomly throughout gdb. Sigh. I wonder if anybody would
complain if we just got rid of it.
Tom