This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: MI - Detecting change of string contents with variable objects
> > Because -var-evaluate-expression uses varobj_get_value so they will always
> > return the same value?
>
> Then, there are two solutions:
We seem to be agree that the patch does the right thing and are just talking
about implementation details.
> 1. Make c_value_of_variable and friends accept struct value as opposed to
> taking struct varobj.
c_value_of_variable, as it's name implies, requires a struct varobj as it's
argument.
> 2. Extra the part of c_value_of_variable that you've based your function on
> into a separate function. Make both c_value_of_variable and install_new_value
> call the new function.
value_get_print_value is quite a small function. After you've wrapped
some statements in if clauses and worked out how to call them with a
common argument, I can't see that you would gain much.
> I'm not sure which approach you find better, but I don't think copy-pasting
> is a solution to anything.
Clearly it is *a* solution, it's just a question of whether it's the *best*
solution in this case. Anyway, it's not a straight copy-paste (the asserts are
removed, for example). I think if you look through the code you'll find
numerous examples where one section of code is a slight variation of another.
--
Nick http://www.inet.net.nz/~nickrob