aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
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/gdbserver
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/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog10
-rw-r--r--gdb/gdbserver/Makefile.in10
-rw-r--r--gdb/gdbserver/debug.c11
-rw-r--r--gdb/gdbserver/debug.h1
4 files changed, 21 insertions, 11 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 14b5a4f..8d42982 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,13 @@
+2014-08-19 Tom Tromey <tromey@redhat.com>
+ Gary Benson <gbenson@redhat.com>
+
+ * 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.
+
2014-08-19 Gary Benson <gbenson@redhat.com>
* utils.h: Do not include print-utils.h.
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 1faa00c..18486c6 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -169,7 +169,8 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
$(srcdir)/common/buffer.c $(srcdir)/nat/linux-btrace.c \
$(srcdir)/common/filestuff.c $(srcdir)/target/waitstatus.c \
$(srcdir)/nat/mips-linux-watch.c $(srcdir)/common/print-utils.c \
- $(srcdir)/common/rsp-low.c $(srcdir)/common/errors.c
+ $(srcdir)/common/rsp-low.c $(srcdir)/common/errors.c \
+ $(srcdir)/common/common-debug.c
DEPFILES = @GDBSERVER_DEPFILES@
@@ -182,8 +183,8 @@ OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o \
target.o waitstatus.o utils.o debug.o version.o vec.o gdb_vecs.o \
mem-break.o hostio.o event-loop.o tracepoint.o xml-utils.o \
common-utils.o ptid.o buffer.o format.o filestuff.o dll.o notif.o \
- tdesc.o print-utils.o rsp-low.o errors.o $(XML_BUILTIN) $(DEPFILES) \
- $(LIBOBJS)
+ tdesc.o print-utils.o rsp-low.o errors.o common-debug.o \
+ $(XML_BUILTIN) $(DEPFILES) $(LIBOBJS)
GDBREPLAY_OBS = gdbreplay.o version.o
GDBSERVER_LIBS = @GDBSERVER_LIBS@
XM_CLIBS = @LIBS@
@@ -540,6 +541,9 @@ agent.o: ../common/agent.c
errors.o: ../common/errors.c
$(COMPILE) $<
$(POSTCOMPILE)
+common-debug.o: ../common/common-debug.c
+ $(COMPILE) $<
+ $(POSTCOMPILE)
waitstatus.o: ../target/waitstatus.c
$(COMPILE) $<
$(POSTCOMPILE)
diff --git a/gdb/gdbserver/debug.c b/gdb/gdbserver/debug.c
index c50af76..339e33c 100644
--- a/gdb/gdbserver/debug.c
+++ b/gdb/gdbserver/debug.c
@@ -33,9 +33,8 @@ int debug_timestamp;
previous call ended with "\n". */
void
-debug_printf (const char *msg, ...)
+debug_vprintf (const char *format, va_list ap)
{
- va_list args;
#if !defined (IN_PROCESS_AGENT)
/* N.B. Not thread safe, and can't be used, as is, with IPA. */
static int new_line = 1;
@@ -53,13 +52,11 @@ debug_printf (const char *msg, ...)
}
#endif
- va_start (args, msg);
- vfprintf (stderr, msg, args);
- va_end (args);
+ vfprintf (stderr, format, ap);
#if !defined (IN_PROCESS_AGENT)
- if (*msg)
- new_line = msg[strlen (msg) - 1] == '\n';
+ if (*format)
+ new_line = format[strlen (format) - 1] == '\n';
#endif
}
diff --git a/gdb/gdbserver/debug.h b/gdb/gdbserver/debug.h
index 0f056ca..42a3f21 100644
--- a/gdb/gdbserver/debug.h
+++ b/gdb/gdbserver/debug.h
@@ -29,7 +29,6 @@
extern int debug_threads;
extern int debug_timestamp;
-void debug_printf (const char *msg, ...) ATTRIBUTE_PRINTF (1, 2);
void debug_flush (void);
void do_debug_enter (const char *function_name);
void do_debug_exit (const char *function_name);