This is the mail archive of the gdb-cvs@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]

[binutils-gdb] windows-nat: Trim a trailing '\n' from OutputDebugString before echoing it


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=040ea00bb02018cbe21ba732f68134ac91f370d2

commit 040ea00bb02018cbe21ba732f68134ac91f370d2
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Jun 3 14:03:50 2015 +0100

    windows-nat: Trim a trailing '\n' from OutputDebugString before echoing it
    
    For cosmetic purposes, trim a trailing '\n' from OutputDebugString before
    echoing it, as warning() will add a '\n', anyhow.
    
    gdb/ChangeLog:
    
    2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
    
    	* windows-nat.c (handle_output_debug_string): Trim trailing '\n'
    	from OutputDebugString.
    
    Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>

Diff:
---
 gdb/ChangeLog     | 5 +++++
 gdb/windows-nat.c | 8 +++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index c824955..bfc6a0e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2015-06-03  Jon Turney  <jon.turney@dronecode.org.uk>
+
+	* windows-nat.c (handle_output_debug_string): Trim trailing '\n'
+	from OutputDebugString.
+
 2015-06-10  Walfred Tedeschi  <walfred.tedeschi@intel.com>
 			Mircea Gherzan  <mircea.gherzan@intel.com>
 
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 701d2c5..851eb51 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -818,7 +818,13 @@ handle_output_debug_string (struct target_waitstatus *ourstatus)
 #ifdef __CYGWIN__
       if (!startswith (s, "cYg"))
 #endif
-	warning (("%s"), s);
+	{
+	  char *p = strchr (s, '\0');
+
+	  if (p > s && *--p == '\n')
+	    *p = '\0';
+	  warning (("%s"), s);
+	}
     }
 #ifdef __COPY_CONTEXT_SIZE
   else


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