gdbsupport, gdb: give names to observers
[deliverable/binutils-gdb.git] / gdbsupport / common-debug.cc
index b8fd133159fb4873d1a725476cd93fa64a12c411..39474c2c8603aea30573778375e49b10f0f2c46f 100644 (file)
@@ -1,6 +1,6 @@
 /* Debug printing functions.
 
-   Copyright (C) 2014-2020 Free Software Foundation, Inc.
+   Copyright (C) 2014-2021 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -39,10 +39,27 @@ debug_printf (const char *fmt, ...)
 /* See gdbsupport/common-debug.h.  */
 
 void
-debug_prefixed_vprintf (const char *module, const char *func, const char *format,
-                       va_list args)
+debug_prefixed_printf (const char *module, const char *func,
+                      const char *format, ...)
 {
-  debug_printf ("[%s] %s: ", module, func);
+  va_list ap;
+
+  va_start (ap, format);
+  debug_prefixed_vprintf (module, func, format, ap);
+  va_end (ap);
+}
+
+/* See gdbsupport/common-debug.h.  */
+
+void
+debug_prefixed_vprintf (const char *module, const char *func,
+                       const char *format, va_list args)
+{
+  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");
 }
This page took 0.023126 seconds and 4 git commands to generate.