From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17490 invoked by alias); 8 Jul 2007 01:22:05 -0000 Received: (qmail 17481 invoked by uid 22791); 8 Jul 2007 01:22:05 -0000 X-Spam-Check-By: sourceware.org Received: from mu-out-0910.google.com (HELO mu-out-0910.google.com) (209.85.134.190) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sun, 08 Jul 2007 01:22:02 +0000 Received: by mu-out-0910.google.com with SMTP id g7so303022muf for ; Sat, 07 Jul 2007 18:21:59 -0700 (PDT) Received: by 10.82.127.14 with SMTP id z14mr5031043buc.1183857719852; Sat, 07 Jul 2007 18:21:59 -0700 (PDT) Received: from ?62.169.106.235? ( [62.169.106.235]) by mx.google.com with ESMTP id h6sm12784327nfh.2007.07.07.18.21.55 (version=TLSv1/SSLv3 cipher=RC4-MD5); Sat, 07 Jul 2007 18:21:59 -0700 (PDT) Message-ID: <4690375A.6030009@portugalmail.pt> Date: Sun, 08 Jul 2007 01:22:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; pt-BR; rv:1.8.0.12) Gecko/20070509 Thunderbird/1.5.0.12 Mnenhy/0.7.4.0 MIME-Version: 1.0 To: gdb-patches@sourceware.org Subject: [gdbserver/win32]: Ignore OUTPUT_DEBUG_STRING_EVENT events when remote is not connected. Content-Type: multipart/mixed; boundary="------------090708080808010803000601" X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2007-07/txt/msg00130.txt.bz2 This is a multi-part message in MIME format. --------------090708080808010803000601 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 537 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 --------------090708080808010803000601 Content-Type: text/x-diff; name="outputdebugstring_not_connected.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="outputdebugstring_not_connected.diff" Content-length: 1838 2007-07-08 Pedro Alves * 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); --------------090708080808010803000601--