[RFC] auto-generate most target debug methods
Thu Jul 17 16:12:00 GMT 2014
>>>>> "Pedro" == Pedro Alves <email@example.com> writes:
Pedro> I think it'll end up being useful to print the arguments before
Pedro> the call too, but I don't think we do that today, so this way
Pedro> looks fine to me.
Doing this means marking "out" parameters so they can be skipped.
This is why I didn't do it, but that was due to using a purely
type-based approach -- with the new machinery it ought to be a bit more
doable, provided we don't mind a ton of macros in target_ops.
>> +static void
>> +delegate_resume (struct target_ops *self, ptid_t arg1, int
>> TARGET_DEBUG_PRINTER (target_debug_print_step) arg2, enum gdb_signal
Pedro> Doesn't really matter much, but would it be trivial to strip
Pedro> out the TARGET_DEBUG_PRINTER part in these generated methods?
Pedro> I wonder about generating the target_foo() entry point methods too...
FWIW I hadn't thought of it. Looking a little, there seems to be a bit
less uniformity here. Some of the entry points do extra work, and some
have extra arguments (I happened to see target_get_section_table).
Of course anything's doable with either some refactoring or more macro
I think the question I would start with is what we would expect to get
from the transform. For the delegation series I think we got a pretty
big reduction in confusion. And for this patch I think we get not just
more uniform and useful debug output, but also simpler maintenance.
One possible benefit from automating the target_* entry points is
simpler maintenance as well. However this has to be weighed against the
loss of readability that comes from having the top-level API disappear
behind a veil of macros and/or generator scripts.
More information about the Gdb-patches