aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/ChangeLog6
-rw-r--r--gdbsupport/common-debug.cc6
-rw-r--r--gdbsupport/common-debug.h8
3 files changed, 19 insertions, 1 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index d973a6d..487107e 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,3 +1,9 @@
+2021-01-22 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * common-debug.h (debug_prefixed_printf_cond_nofunc): New.
+ * common-debug.c (debug_prefixed_vprintf): Handle a nullptr
+ func.
+
2021-01-08 Simon Marchi <simon.marchi@polymtl.ca>
PR gdb/27157
diff --git a/gdbsupport/common-debug.cc b/gdbsupport/common-debug.cc
index 0d3e919..39474c2 100644
--- a/gdbsupport/common-debug.cc
+++ b/gdbsupport/common-debug.cc
@@ -55,7 +55,11 @@ void
debug_prefixed_vprintf (const char *module, const char *func,
const char *format, va_list args)
{
- debug_printf ("%*s[%s] %s: ", debug_print_depth * 2, "", module, func);
+ if (func != nullptr)
+ debug_printf ("%*s[%s] %s: ", debug_print_depth * 2, "", module, func);
+ else
+ debug_printf ("%*s[%s] ", debug_print_depth * 2, "", module);
+
debug_vprintf (format, args);
debug_printf ("\n");
}
diff --git a/gdbsupport/common-debug.h b/gdbsupport/common-debug.h
index f313787..0536740 100644
--- a/gdbsupport/common-debug.h
+++ b/gdbsupport/common-debug.h
@@ -66,6 +66,14 @@ extern void ATTRIBUTE_PRINTF (3, 0) debug_prefixed_vprintf
} \
while (0)
+#define debug_prefixed_printf_cond_nofunc(debug_enabled_cond, module, fmt, ...) \
+ do \
+ { \
+ if (debug_enabled_cond) \
+ debug_prefixed_printf (module, nullptr, fmt, ##__VA_ARGS__); \
+ } \
+ while (0)
+
/* Nesting depth of scoped_debug_start_end objects. */
extern int debug_print_depth;