aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2020-10-02 14:44:39 -0400
committerSimon Marchi <simon.marchi@efficios.com>2020-10-02 14:47:26 -0400
commitba98841943b085891eb4bf4debc3981ac95bb7fb (patch)
tree5ca587e395283d3e301bb1b5801f01f1c1c2cab2
parentdb20ebdfae432f23def32f0b9bbf6e023c926235 (diff)
downloadgdb-ba98841943b085891eb4bf4debc3981ac95bb7fb.zip
gdb-ba98841943b085891eb4bf4debc3981ac95bb7fb.tar.gz
gdb-ba98841943b085891eb4bf4debc3981ac95bb7fb.tar.bz2
gdb: move debug_prefixed_vprintf here
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
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/debug.c13
-rw-r--r--gdb/debug.h32
-rw-r--r--gdb/infrun.c2
-rw-r--r--gdb/linux-nat.c2
-rw-r--r--gdbsupport/ChangeLog5
-rw-r--r--gdbsupport/common-debug.cc11
-rw-r--r--gdbsupport/common-debug.h6
8 files changed, 32 insertions, 46 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 3b60116..9f74494 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
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
parameter.
(create_async_event_handler): Likewise.
diff --git a/gdb/debug.c b/gdb/debug.c
index f845a7e..fe571aa 100644
--- a/gdb/debug.c
+++ b/gdb/debug.c
@@ -19,7 +19,7 @@
#include "defs.h"
-#include "debug.h"
+#include "gdbsupport/common-debug.h"
/* See gdbsupport/common-debug.h. */
@@ -28,14 +28,3 @@ debug_vprintf (const char *fmt, va_list ap)
{
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");
-}
diff --git a/gdb/debug.h b/gdb/debug.h
deleted file mode 100644
index 1d98fbe..0000000
--- a/gdb/debug.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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 */
-
-
diff --git a/gdb/infrun.c b/gdb/infrun.c
index 0458c3a..d552fb3 100644
--- a/gdb/infrun.c
+++ b/gdb/infrun.c
@@ -70,7 +70,7 @@
#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 */
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 7b9b267..24f9716 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -68,7 +68,7 @@
#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.
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 */