gdb: factor out debug_prefixed_printf_cond
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 11 Dec 2020 18:48:11 +0000 (13:48 -0500)
committerSimon Marchi <simon.marchi@polymtl.ca>
Fri, 11 Dec 2020 19:01:12 +0000 (14:01 -0500)
commit74b773fcd658c52554a6af07c657f677c52f8102
treeb192e163ad6ce311802e338938c9fd7e8dfddb51
parent346e7e192370a4d602e14466825c329ed5920c8f
gdb: factor out debug_prefixed_printf_cond

The same pattern happens often to define a "debug_printf" macro:

    #define displaced_debug_printf(fmt, ...) \
      do \
        { \
          if (debug_displaced) \
     debug_prefixed_printf ("displaced", __func__, fmt, ##__VA_ARGS__); \
        } \
      while (0)

Move this pattern behind a helper macro, debug_prefixed_printf_cond and
update the existing macros to use it.

gdb/ChangeLog:

* displaced-stepping.h (displaced_debug_printf): Use
debug_prefixed_printf_cond.
* dwarf2/read.c (dwarf_read_debug_printf): Likewise.
(dwarf_read_debug_printf_v): Likewise.
* infrun.h (infrun_debug_printf): Likewise.
* linux-nat.c (linux_nat_debug_printf): Likewise.

gdbsupport/ChangeLog:

* common-debug.h (debug_prefixed_printf_cond): New.
* event-loop.h (event_loop_debug_printf): Use
debug_prefixed_printf_cond.

Change-Id: I1ff48b98b8d1cc405d1c7e8da8ceadf4e3a17f99
gdb/ChangeLog
gdb/displaced-stepping.h
gdb/dwarf2/read.c
gdb/infrun.h
gdb/linux-nat.c
gdbsupport/ChangeLog
gdbsupport/common-debug.h
gdbsupport/event-loop.h