The following patch needs to output debug prints from gdbsupport code.
Move debug_prefixed_vprintf so that it is possible to use it from
gdbsupport.
gdb/ChangeLog:
* debug.c (debug_prefixed_vprintf): Move to gdbsupport.
* debug.h: Remove.
* infrun.c: Include gdbsupport/common-debug.h.
* linux-nat.c: Likewise.
gdbsupport/ChangeLog:
* common-debug.cc (debug_prefixed_vprintf): Move here.
* common-debug.h (debug_prefixed_vprintf): Move here.
Change-Id: I5170065fc10a7a49c0f1bba67c691decb2cf3bcb
+2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * debug.c (debug_prefixed_vprintf): Move to gdbsupport.
+ * debug.h: Remove.
+ * infrun.c: Include gdbsupport/common-debug.h.
+ * linux-nat.c: Likewise.
+
2020-10-02 Simon Marchi <simon.marchi@polymtl.ca>
* async-event.h (create_async_signal_handler): Add name
#include "defs.h"
-#include "debug.h"
+#include "gdbsupport/common-debug.h"
/* See gdbsupport/common-debug.h. */
{
vfprintf_unfiltered (gdb_stdlog, fmt, ap);
}
-
-/* See 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");
-}
+++ /dev/null
-/* Helpers to format and print debug statements
-
- Copyright (C) 2020 Free Software Foundation, Inc.
-
- This file is part of GDB.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef DEBUG_H
-#define DEBUG_H
-
-/* Print a debug statement prefixed with the module and function name, and
- with a newline at the end. */
-
-void ATTRIBUTE_PRINTF (3, 0)
-debug_prefixed_vprintf (const char *module, const char *func, const char *format,
- va_list args);
-
-#endif /* DEBUG_H */
-
-
#include "gdbsupport/selftest.h"
#include "scoped-mock-context.h"
#include "test-target.h"
-#include "debug.h"
+#include "gdbsupport/common-debug.h"
/* Prototypes for local functions */
#include "gdbsupport/fileio.h"
#include "gdbsupport/scope-exit.h"
#include "gdbsupport/gdb-sigmask.h"
-#include "debug.h"
+#include "gdbsupport/common-debug.h"
/* This comment documents high-level logic of this file.
+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.
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");
+}
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 */