Re: [PATCH] gdb: add linux_nat_debug_printf macro

Gary Benson
2020-07-10T11:48:02Z

Simon Marchi wrote:
> diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
> index fde360f5080a..3b5c803b83fd 100644
> --- a/gdb/linux-nat.c
> +++ b/gdb/linux-nat.c
> @@ -198,6 +198,27 @@ show_debug_linux_nat (struct ui_file *file, int from_tty,
> value);
> }
>
> +/* Print a debug statement. Should be used through linux_nat_debug_printf. */
> +
> +static void ATTRIBUTE_PRINTF (2, 3)
> +linux_nat_debug_printf_1 (const char *func_name, const char *fmt, ...)
> +{
> + fprintf_unfiltered (gdb_stdlog, "[linux-nat] %s: ", func_name);
> +
> + va_list ap;
> + va_start (ap, fmt);
> + vfprintf_unfiltered (gdb_stdlog, fmt, ap);
> + va_end (ap);
> +
> + fprintf_unfiltered (gdb_stdlog, "\n");
> +}

Would it be useful to use debug_printf and debug_vprintf here?

Thanks,
Gary

--
Gary Benson - he / him / his
Principal Software Engineer, Red Hat