[pushed] gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions
Andrew Burgess
andrew.burgess@embecosm.com
Sat Oct 31 22:01:32 GMT 2020
This commit caused GDB to unconditionally print out debug tracing.
I pushed the following patch to resolve this issue. Hopefully this is
OK.
Thanks,
Andrew
---
>From 4f0469cdd6a7637168bde415ed5dae6b1702d44e Mon Sep 17 00:00:00 2001
From: Andrew Burgess <andrew.burgess@embecosm.com>
Date: Sat, 31 Oct 2020 21:50:44 +0000
Subject: [PATCH] gdb: restore some checks of debug flags
This partially reverts some parts of the commit:
commit 17417fb0ec9842de1774e1e76f1f11c00cdafc47
Date: Sat Oct 31 09:01:25 2020 -0400
gdb, gdbsupport: add debug_prefixed_printf, remove boilerplate functions
This commit removed 3 places where some debug flags were being
checked. The result was that debug tracing was being printed
unconditionally.
This commit adds back the 3 flag checks.
gdb/ChangeLog:
* infrun.h (infrun_debug_printf): Add check of debug_infrun flag.
(debug_prefixed_printf): Add check of debug_displaced flag.
* linux-nat.c (linux_nat_debug_printf): Add check of
debug_linux_nat flag.
---
gdb/ChangeLog | 7 +++++++
gdb/infrun.h | 14 ++++++++++++--
gdb/linux-nat.c | 7 ++++++-
3 files changed, 25 insertions(+), 3 deletions(-)
diff --git a/gdb/infrun.h b/gdb/infrun.h
index 93b8aeb8eaa..2084d3d16b5 100644
--- a/gdb/infrun.h
+++ b/gdb/infrun.h
@@ -34,7 +34,12 @@ extern unsigned int debug_infrun;
/* Print an "infrun" debug statement. */
#define infrun_debug_printf(fmt, ...) \
- debug_prefixed_printf ("infrun", __func__, fmt, ##__VA_ARGS__)
+ do \
+ { \
+ if (debug_infrun) \
+ debug_prefixed_printf ("infrun", __func__, fmt, ##__VA_ARGS__); \
+ } \
+ while (0)
/* True if we are debugging displaced stepping. */
extern bool debug_displaced;
@@ -42,7 +47,12 @@ extern bool debug_displaced;
/* Print a "displaced" debug statement. */
#define displaced_debug_printf(fmt, ...) \
- debug_prefixed_printf ("displaced", __func__, fmt, ##__VA_ARGS__)
+ do \
+ { \
+ if (debug_displaced) \
+ debug_prefixed_printf ("displaced", __func__, fmt, ##__VA_ARGS__); \
+ } \
+ while (0)
/* Nonzero if we want to give control to the user when we're notified
of shared library events by the dynamic linker. */
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index d79ea842c2d..3666ed6f923 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -202,7 +202,12 @@ show_debug_linux_nat (struct ui_file *file, int from_tty,
/* Print a linux-nat debug statement. */
#define linux_nat_debug_printf(fmt, ...) \
- debug_prefixed_printf ("linux-nat", __func__, fmt, ##__VA_ARGS__)
+ do \
+ { \
+ if (debug_linux_nat) \
+ debug_prefixed_printf ("linux-nat", __func__, fmt, ##__VA_ARGS__); \
+ } \
+ while (0)
struct simple_pid_list
{
--
2.25.4
More information about the Gdb-patches
mailing list