aboutsummaryrefslogtreecommitdiff
path: root/gdbsupport
diff options
context:
space:
mode:
Diffstat (limited to 'gdbsupport')
-rw-r--r--gdbsupport/ChangeLog5
-rw-r--r--gdbsupport/common-debug.cc11
-rw-r--r--gdbsupport/common-debug.h6
3 files changed, 22 insertions, 0 deletions
diff --git a/gdbsupport/ChangeLog b/gdbsupport/ChangeLog
index b54bfb9..d5b20ec 100644
--- a/gdbsupport/ChangeLog
+++ b/gdbsupport/ChangeLog
@@ -1,5 +1,10 @@
2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
+ * common-debug.cc (debug_prefixed_vprintf): Move here.
+ * common-debug.h (debug_prefixed_vprintf): Move here.
+
+2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
+
* event-loop.h (add_file_handler): Add "name" parameter.
* event-loop.cc (struct file_handler) <name>: New field.
(create_file_handler): Add "name" parameter, assign it to file
diff --git a/gdbsupport/common-debug.cc b/gdbsupport/common-debug.cc
index d1131a0..b8fd133 100644
--- a/gdbsupport/common-debug.cc
+++ b/gdbsupport/common-debug.cc
@@ -35,3 +35,14 @@ debug_printf (const char *fmt, ...)
debug_vprintf (fmt, 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)
+{
+ debug_printf ("[%s] %s: ", module, func);
+ debug_vprintf (format, args);
+ debug_printf ("\n");
+}
diff --git a/gdbsupport/common-debug.h b/gdbsupport/common-debug.h
index 9934ec5..afb427e1 100644
--- a/gdbsupport/common-debug.h
+++ b/gdbsupport/common-debug.h
@@ -38,4 +38,10 @@ extern void debug_printf (const char *format, ...)
extern void debug_vprintf (const char *format, va_list ap)
ATTRIBUTE_PRINTF (1, 0);
+/* Print a debug statement prefixed with the module and function name, and
+ with a newline at the end. */
+
+extern void ATTRIBUTE_PRINTF (3, 0) debug_prefixed_vprintf
+ (const char *module, const char *func, const char *format, va_list args);
+
#endif /* COMMON_COMMON_DEBUG_H */