Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [gdbserver/win32]: Ignore OUTPUT_DEBUG_STRING_EVENT events when remote  is not connected.
@ 2007-07-08  1:22 Pedro Alves
  2007-07-08  3:48 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Pedro Alves @ 2007-07-08  1:22 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 537 bytes --]

Hi,

OUTPUT_DEBUG_STRING_EVENT events can happen from after the inferior
is created, until it is stopped at the initial breakpoint, waiting
for gdb.  The OUTPUT_DEBUG_STRING_EVENT handler doesn't currently
check if a remote connection is open before sending data, generating
annoying putpkt error logs to gdbserver's console.  This
patch fixes it by simply ignoring those events when there isn't any
gdb connected yet.  I didn't use server_wait, because this event
is also handled in win32_kill, outside of a wait.

Cheers,
Pedro Alves


[-- Attachment #2: outputdebugstring_not_connected.diff --]
[-- Type: text/x-diff, Size: 1838 bytes --]

2007-07-08  Pedro Alves  <pedro_alves@portugalmail.pt>

	* server.h (remote_connected): Declare.
	* remote-utils.c (remote_connected): Define.
	* win32-low.c (handle_output_debug_string): Don't send data to a
	non-existing remote.

---
 gdb/gdbserver/remote-utils.c |    6 ++++++
 gdb/gdbserver/server.h       |    2 ++
 gdb/gdbserver/win32-low.c    |    3 +++
 3 files changed, 11 insertions(+)

Index: src/gdb/gdbserver/remote-utils.c
===================================================================
--- src.orig/gdb/gdbserver/remote-utils.c	2007-07-08 00:58:26.000000000 +0100
+++ src/gdb/gdbserver/remote-utils.c	2007-07-08 01:04:38.000000000 +0100
@@ -1242,3 +1242,9 @@ xml_escape_text (const char *text)
 
   return result;
 }
+
+int
+remote_connected (void)
+{
+  return (remote_desc != -1);
+}
Index: src/gdb/gdbserver/win32-low.c
===================================================================
--- src.orig/gdb/gdbserver/win32-low.c	2007-07-08 00:52:44.000000000 +0100
+++ src/gdb/gdbserver/win32-low.c	2007-07-08 01:05:52.000000000 +0100
@@ -544,6 +544,9 @@ handle_output_debug_string (struct targe
   char s[READ_BUFFER_LEN + 1] = { 0 };
   DWORD nbytes = current_event.u.DebugString.nDebugStringLength;
 
+  if (!remote_connected ())
+    return;
+
   if (nbytes == 0)
     return;
 
Index: src/gdb/gdbserver/server.h
===================================================================
--- src.orig/gdb/gdbserver/server.h	2007-07-08 01:01:06.000000000 +0100
+++ src/gdb/gdbserver/server.h	2007-07-08 01:04:54.000000000 +0100
@@ -205,6 +205,8 @@ void monitor_output (const char *msg);
 
 char *xml_escape_text (const char *text);
 
+int remote_connected (void);
+
 /* Functions from ``signals.c''.  */
 enum target_signal target_signal_from_host (int hostsig);
 int target_signal_to_host_p (enum target_signal oursig);


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-07-08 17:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-08  1:22 [gdbserver/win32]: Ignore OUTPUT_DEBUG_STRING_EVENT events when remote is not connected Pedro Alves
2007-07-08  3:48 ` Daniel Jacobowitz
2007-07-08 14:45   ` Pedro Alves
2007-07-08 17:22     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox