This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 9/9 v7] Remove one GDBSERVER use from linux-waitpid.c


This commit makes nat/linux-waitpid.c include common-defs.h rather
than defs.h or server.h.  Some debug code previously only built for
gdbserver is now also built for GDB, and a use of GDBSERVER has had
to remain in order to select the variable used to determine whether
debug printing should be enabled.

This patch differs from the version I posted on August 1
(https://sourceware.org/ml/gdb-patches/2014-08/msg00016.html)
in that previously debug printing was only built for gdbserver
(enabled when debug_threads is set) but now it is also built
for GDB (enabled when debug_linux_nat is set).  I had to make
debug_linux_nat nonstatic to do this.

gdb/ChangeLog:

	* linux-nat.c (debug_linux_nat): Make nonstatic.
	* nat/linux-waitpid.c: Include common-defs.h.
	Don't include defs.h, server.h or signal.h.
	(debug_linux_waitpid): New macro and extern.
	(linux_debug): Use debug_linux_waitpid and debug_vprintf.
---
 gdb/ChangeLog           |    8 ++++++++
 gdb/linux-nat.c         |    3 ++-
 gdb/nat/linux-waitpid.c |   25 +++++++++++++------------
 3 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 0898442..2e0aedc 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -204,7 +204,8 @@ static target_xfer_partial_ftype *super_xfer_partial;
    Called by our to_close.  */
 static void (*super_close) (struct target_ops *);
 
-static unsigned int debug_linux_nat;
+unsigned int debug_linux_nat;
+
 static void
 show_debug_linux_nat (struct ui_file *file, int from_tty,
 		      struct cmd_list_element *c, const char *value)
diff --git a/gdb/nat/linux-waitpid.c b/gdb/nat/linux-waitpid.c
index 53847ac..7fea870 100644
--- a/gdb/nat/linux-waitpid.c
+++ b/gdb/nat/linux-waitpid.c
@@ -17,16 +17,20 @@
    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 "common-defs.h"
+#include "linux-nat.h"
+#include "linux-waitpid.h"
+#include "gdb_wait.h"
+
+/* FIXME: Need a common variable to select Linux debug output.  */
+
 #ifdef GDBSERVER
-#include "server.h"
+#define debug_linux_waitpid debug_threads
 #else
-#include "defs.h"
-#include "signal.h"
+#define debug_linux_waitpid debug_linux_nat
 #endif
 
-#include "linux-nat.h"
-#include "linux-waitpid.h"
-#include "gdb_wait.h"
+extern int debug_linux_waitpid;
 
 /* Print debugging output based on the format string FORMAT and
    its parameters.  */
@@ -34,17 +38,14 @@
 static inline void
 linux_debug (const char *format, ...)
 {
-#ifdef GDBSERVER
-  if (debug_threads)
+  if (debug_linux_waitpid)
     {
       va_list args;
+
       va_start (args, format);
-      vfprintf (stderr, format, args);
+      debug_vprintf (format, args);
       va_end (args);
     }
-#else
-  /* GDB-specific debugging output.  */
-#endif
 }
 
 /* Convert wait status STATUS to a string.  Used for printing debug
-- 
1.7.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]