From 17417fb0ec9842de1774e1e76f1f11c00cdafc47 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 31 Oct 2020 09:01:25 -0400 Subject: gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions The *_debug_print_1 functions are all very similar, the only difference being the subsystem name. Remove them all and make the logging macros use a new debug_prefixed_printf function directly. gdb/ChangeLog: * infrun.c (infrun_debug_printf_1): Remove. (displaced_debug_printf_1): Remove. (stop_all_threads): Use debug_prefixed_printf. * infrun.h (infrun_debug_printf_1): Remove. (infrun_debug_printf): Use debug_prefixed_printf. (displaced_debug_printf_1): Remove. (displaced_debug_printf): Use debug_prefixed_printf. * linux-nat.c (linux_nat_debug_printf_1): Remove. (linux_nat_debug_printf): Use debug_prefixed_printf. gdbsupport/ChangeLog: * common-debug.cc (debug_prefixed_printf): New. * common-debug.h (debug_prefixed_printf): New declaration. * event-loop.cc (event_loop_debug_printf_1): Remove. * event-loop.h (event_loop_debug_printf_1): Remove. (event_loop_debug_printf): Use debug_prefixed_printf. (event_loop_ui_debug_printf): Use debug_prefixed_printf. Change-Id: Ib323087c7257f0060121d302055c41eb64aa60c6 --- gdb/linux-nat.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'gdb/linux-nat.c') diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c index 24f9716..d79ea84 100644 --- a/gdb/linux-nat.c +++ b/gdb/linux-nat.c @@ -199,24 +199,10 @@ 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, ...) -{ - va_list ap; - va_start (ap, fmt); - debug_prefixed_vprintf ("linux-nat", func_name, fmt, ap); - va_end (ap); -} +/* Print a linux-nat debug statement. */ #define linux_nat_debug_printf(fmt, ...) \ - do \ - { \ - if (debug_linux_nat) \ - linux_nat_debug_printf_1 (__func__, fmt, ##__VA_ARGS__); \ - } \ - while (0) + debug_prefixed_printf ("linux-nat", __func__, fmt, ##__VA_ARGS__) struct simple_pid_list { -- cgit v1.1