aboutsummaryrefslogtreecommitdiff
path: root/gdb/debug.c
diff options
context:
space:
mode:
authorGary Benson <gbenson@redhat.com>2014-07-30 16:21:55 +0100
committerGary Benson <gbenson@redhat.com>2014-08-19 10:07:20 +0100
commit34abf635b3edf9d70b24aa655ffd7d4696d48cde (patch)
tree589de322e6cadff3b9cf9475927ee15e021903f9 /gdb/debug.c
parentf6e94d78b2fe30977ffefcb26420109940ca7bb1 (diff)
downloadgdb-34abf635b3edf9d70b24aa655ffd7d4696d48cde.zip
gdb-34abf635b3edf9d70b24aa655ffd7d4696d48cde.tar.gz
gdb-34abf635b3edf9d70b24aa655ffd7d4696d48cde.tar.bz2
Introduce common-debug.h
This introduces common-debug.h. This holds the functions debug_printf and debug_vprintf, two functions that the common code can use to print debugging messages. Clients of the common code are expected to implement debug_vprintf; a debug_vprintf function is written from scratch for GDB, and gdbserver's existing debug_printf is repurposed as debug_vprintf. common/agent.c is changed to use debug_vprintf rather than defining the macro DEBUG_AGENT depending on GDBSERVER. nat/i386-dregs.c is changed to use the externally-implemented debug_printf, rather than defining it itself. gdb/ChangeLog: * common/common-debug.h: New file. * common/common-debug.c: Likewise. * debug.c: Likewise. * Makefile.in (SFILES): Add common/common-debug.c. (HFILES_NO_SRCDIR): Add common/common-debug.h. (COMMON_OBS): Add common-debug.o and debug.o. (common-debug.o): New rule. * common/common-defs.h: Include common-debug.h. * common/agent.c (debug_agent_printf): New function. (DEBUG_AGENT): Redefine. * nat/i386-dregs.c (debug_printf): Undefine. gdb/gdbserver/ChangeLog: * Makefile.in (SFILES): Add common/common-debug.c. (OBS): Add common-debug.o. (common-debug.o): New rule. * debug.h (debug_printf): Don't declare. * debug.c (debug_printf): Renamed and rewritten as... (debug_vprintf): New function.
Diffstat (limited to 'gdb/debug.c')
-rw-r--r--gdb/debug.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gdb/debug.c b/gdb/debug.c
new file mode 100644
index 0000000..95cf617
--- /dev/null
+++ b/gdb/debug.c
@@ -0,0 +1,28 @@
+/* Debug printing functions.
+
+ Copyright (C) 2014 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/>. */
+
+#include "defs.h"
+
+/* See common/common-debug.h. */
+
+void
+debug_vprintf (const char *fmt, va_list ap)
+{
+ vfprintf_unfiltered (gdb_stdlog, fmt, ap);
+}