This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [patch] function eval cleanup


>>>>> "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


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