[PATCH] gdb: introduce displaced_debug_printf

Tom Tromey tom@tromey.com
Fri Oct 30 19:07:20 GMT 2020


>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> 	* infrun.h (displaced_debug_printf): New macro.  Replace
Simon> 	displaced debug prints throughout to use it.
Simon> 	(displaced_debug_printf_1): New declaration.
Simon> 	(displaced_step_dump_bytes): Return string, remove ui_file
Simon> 	parameter, update all callers.
Simon> 	* infrun.c (displaced_debug_printf_1): New function.
Simon> 	(displaced_step_dump_bytes): Return string, remove ui_file
Simon> 	parameter

I think this is fine, but I wonder if we could get this same
functionality without needing a new function for each one:

Simon> +void
Simon> +displaced_debug_printf_1 (const char *func_name, const char *fmt, ...)
Simon> +{
Simon> +  va_list ap;
Simon> +  va_start (ap, fmt);
Simon> +  debug_prefixed_vprintf ("displaced", func_name, fmt, ap);
Simon> +  va_end (ap);

Like maybe there could be a non-"v" variant of debug_prefixed_vprintf.
Then new wrapper macros could simply pass in the string constant.

Tom


More information about the Gdb-patches mailing list