This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] auto-generate most target debug methods
- From: Pedro Alves <palves at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Thu, 17 Jul 2014 15:46:48 +0100
- Subject: Re: [RFC] auto-generate most target debug methods
- Authentication-results: sourceware.org; auth=none
- References: <1403208237-27023-1-git-send-email-tromey at redhat dot com> <53C5042B dot 6080406 at redhat dot com> <87sim1z71y dot fsf at fleche dot redhat dot com>
On 07/16/2014 03:56 PM, Tom Tromey wrote:
> Pedro> I like the idea of this patch a lot.
> [...]
> Pedro> Did you try an __attribute__(())-like approach? Something like:
>
> Appended is a patch that works this way.
This looks great to me.
> static void
> +debug_post_attach (struct target_ops *self, int arg1)
> +{
> + fprintf_unfiltered (gdb_stdlog, "-> %s->to_post_attach (...)\n", debug_target.to_shortname);
> + debug_target.to_post_attach (&debug_target, arg1);
> + fprintf_unfiltered (gdb_stdlog, "<- %s->to_post_attach (", debug_target.to_shortname);
> + target_debug_print_struct_target_ops_p (&debug_target);
> + fputs_unfiltered (", ", gdb_stdlog);
> + target_debug_print_int (arg1);
> + fputs_unfiltered (")\n", gdb_stdlog);
I think it'll end up being useful to print the arguments before
the call too, but I don't think we do that today, so this way
looks fine to me.
> +static void
> +delegate_resume (struct target_ops *self, ptid_t arg1, int TARGET_DEBUG_PRINTER (target_debug_print_step) arg2, enum gdb_signal arg3)
Doesn't really matter much, but would it be trivial to strip
out the TARGET_DEBUG_PRINTER part in these generated methods?
Thanks!
I wonder about generating the target_foo() entry point methods too...
--
Pedro Alves