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]

gdbserver/win32, respect --debug switch.


I've applied this patch, to be able to enable win32 debug output with
'gdbserver --debug ...', instead of having to recompile gdbserver.

Also fixes some bit rot: gdbserver wasn't compiling with LOG==1 anymore.

-- 
Pedro Alves

2009-11-26  Pedro Alves  <pedro@codesourcery.com>

	gdb/gdbserver/
	* win32-low.c (LOG): Delete.
	(OUTMSG): Output to stderr.
	(OUTMSG2): Conditionalize on `debug_threads' variable, instead of
	on compile time LOG macro.
	(win32_wait): Fix debug output.

---
 gdb/gdbserver/win32-low.c |   19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

Index: src/gdb/gdbserver/win32-low.c
===================================================================
--- src.orig/gdb/gdbserver/win32-low.c	2009-11-26 19:20:00.000000000 +0000
+++ src/gdb/gdbserver/win32-low.c	2009-11-26 19:20:21.000000000 +0000
@@ -38,14 +38,17 @@
 #include <sys/cygwin.h>
 #endif
 
-#define LOG 0
+#define OUTMSG(X) do { printf X; fflush (stderr); } while (0)
 
-#define OUTMSG(X) do { printf X; fflush (stdout); } while (0)
-#if LOG
-#define OUTMSG2(X) do { printf X; fflush (stdout); } while (0)
-#else
-#define OUTMSG2(X) do ; while (0)
-#endif
+#define OUTMSG2(X) \
+  do						\
+    {						\
+      if (debug_threads)			\
+	{					\
+	  printf X;				\
+	  fflush (stderr);			\
+	}					\
+    } while (0)
 
 #ifndef _T
 #define _T(x) TEXT (x)
@@ -1586,7 +1589,7 @@ win32_wait (ptid_t ptid, struct target_w
 	case TARGET_WAITKIND_STOPPED:
 	case TARGET_WAITKIND_LOADED:
 	  OUTMSG2 (("Child Stopped with signal = %d \n",
-		    our_status.value.sig));
+		    ourstatus->value.sig));
 
 	  child_fetch_inferior_registers (-1);
 


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