gdb: move debug_prefixed_vprintf here
authorSimon Marchi <simon.marchi@polymtl.ca>
Fri, 2 Oct 2020 18:44:39 +0000 (14:44 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 2 Oct 2020 18:47:26 +0000 (14:47 -0400)
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

gdb/ChangeLog
gdb/debug.c
gdb/debug.h [deleted file]
gdb/infrun.c
gdb/linux-nat.c
gdbsupport/ChangeLog
gdbsupport/common-debug.cc
gdbsupport/common-debug.h

index 3b60116d273aca379558f8c2302bf2caa88549d6..9f744944fd45050d7a174cb18a469b76b4466b1e 100644 (file)
@@ -1,3 +1,10 @@
+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
index f845a7e3b1e708f99aea2e8665317c132de27dd1..fe571aaae393de71c6f9d5e40d4df3dfc808015a 100644 (file)
@@ -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 (file)
index 1d98fbe..0000000
+++ /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 */
-
-
index 0458c3acb9d4964a88a0da7562020e10375dbdd1..d552fb3adb26906621aab42b683d40b864ab7dfe 100644 (file)
@@ -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 */
 
index 7b9b267fc73f0d37a9d4ac3f2f6af44b31a6d23f..24f971680ca52671bfd42c876044d99ca00860a5 100644 (file)
@@ -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.
 
index b54bfb945ad93ad2437ca425b9619a83b40de5fb..d5b20ec0b64e0fddfb05bcc5dd6515eb3c18659e 100644 (file)
@@ -1,3 +1,8 @@
+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.
index d1131a0a8796338b3ed243cc567c028b35300dd6..b8fd133159fb4873d1a725476cd93fa64a12c411 100644 (file)
@@ -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");
+}
index 9934ec543d28cf7a03affd63299f328f2dae9e8d..afb427e18005088efd1d7093407df891f2d87e11 100644 (file)
@@ -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 */
This page took 0.044231 seconds and 4 git commands to generate.